[Moo] Refresh div

18 messages Options
Embed this post
Permalink
Deepali-2-3

[Moo] Refresh div

Reply Threaded More More options
Print post
Permalink


Hello,

There are so many script available for to auto refresh div. but i
didn't find many of them for on click refresh div with mootools.

With this code i am able to refreshes the whole page

<script>
 $(function()
  {

       $("#refresh").click(function(){
       $("#mydiv").load("index.html")
      })
  })
</script>

                <h2>Looking for</h2>


                <div id="Container"></div>
        <a href="index.html"id="refresh">click</a>


But, i want to refresh only div that to onclick.something like this
http://search.twitter.com/search?q=helloween

it shows the tweets related with the helloween, after few minutes if
something new(tweets) comes up it shows only when we click on the
refresh button only. It means only that particular div gets refreshed
on click.

Can anyone tell me any resources or tell me how can i do that?


Thanks in advance.
Report to moderator   123.236.8.108
Sanford Whiteman [Mobile]

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Thanks for your reply sandy,

i have checked that link and tried something like this

<script>
 window.addEvent('domeready', function(){

 $("#refresh").load("Container");



 });

</script>

                <h2>Looking for</h2>


                <div id="rContainer"></div>
        <a href="#"id="refresh">click</a>

No need to say that  its not working. What i was thinking is it
because i have put up "#" into href? or do i need to put anything else
there?

On Nov 4, 10:42 am, Sanford Whiteman <[hidden email]>
wrote:
> http://mootools.net/docs/core/Element/Element#Element-Properties:html
>
> -- Sandy
Sanford Whiteman [Mobile]

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

>  window.addEvent('domeready', function(){

'domready'

>  $("#refresh").load("Container");

Don't seek an ID with a selector. Just $('refresh').

What  is  this  load()  business? load() takes a URL. Is 'container' a
URL?

I sent you to set('html',...). Try that first.

-- Sandy

Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

NO, container is not an url, its containing a vidows i am fetching
from the flicks. so i just want to refresh this div on the click

I am not sure what to put here

"set('html',...)."

I want to user refresh button for it. so my page is something like
this

http://mooshell.net/bg93L/1

What can  i need to do to refresh only particular div?
On Nov 4, 11:42 am, Sanford Whiteman <[hidden email]>
wrote:

> >  window.addEvent('domeready', function(){
>
> 'domready'
>
> >  $("#refresh").load("Container");
>
> Don't seek an ID with a selector. Just $('refresh').
>
> What  is  this  load()  business? load() takes a URL. Is 'container' a
> URL?
>
> I sent you to set('html',...). Try that first.
>
> -- Sandy
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
In reply to this post by Sanford Whiteman [Mobile]

NO, container is not containing  url, its containing a videos i am
fetching
from the flicks. so i just want to refresh this div on the click

I am not sure what to put here

"set('html',...)."

I want to user refresh button for it. so my page is something like
this

http://mooshell.net/bg93L/1

On Nov 4, 11:42 am, Sanford Whiteman <[hidden email]>
wrote:

> >  window.addEvent('domeready', function(){
>
> 'domready'
>
> >  $("#refresh").load("Container");
>
> Don't seek an ID with a selector. Just $('refresh').
>
> What  is  this  load()  business? load() takes a URL. Is 'container' a
> URL?
>
> I sent you to set('html',...). Try that first.
>
> -- Sandy
Sanford Whiteman [Mobile]

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
In reply to this post by Deepali-2-3

> NO, container is not an url, its containing a vidows i am fetching
> from the flicks. so i just want to refresh this div on the click

load() takes a URL -- so you need to reread the docs for load().

> I am not sure what to put here

> "set('html',...)."

Did you read the docs and examples for set()?

You will find that there are a number of different convenience methods
to  go  about  an XHR update of the (inner) HTML of an element, all of
them wrapping the same underlying method. You should first know how to
do  it  manually,  that  is, not from a remote server but from a local
string.

-- Sandy

Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

I was reading about the set function and its properties and have found
this
$('myImage').setProperty('src', 'mootools.png');

Note
* Whenever using Element:setProperty to set an attribute, pass in the
lowercase, simplified form of the property. For example:
          o use 'for', not 'htmlFor',
          o use 'class', not 'className'
          o use 'frameborder', not 'frameBorder'
          o etc.
Do i need to use iframe here? because i am not showing any image. so
do i need to create different page(something.html) and put that into
iframes and called its id on refresh? Could you please tell me.

On Nov 4, 12:16 pm, Sanford Whiteman <[hidden email]>
wrote:

> > NO, container is not an url, its containing a vidows i am fetching
> > from the flicks. so i just want to refresh this div on the click
>
> load() takes a URL -- so you need to reread the docs for load().
>
> > I am not sure what to put here
> > "set('html',...)."
>
> Did you read the docs and examples for set()?
>
> You will find that there are a number of different convenience methods
> to  go  about  an XHR update of the (inner) HTML of an element, all of
> them wrapping the same underlying method. You should first know how to
> do  it  manually,  that  is, not from a remote server but from a local
> string.
>
> -- Sandy
Sanford Whiteman [Mobile]

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

> I was reading about the set function and its properties and have found
> this
> $('myImage').setProperty('src', 'mootools.png');

Please follow the actual link I sent in my first response to you.

Have you gone through the Mootorial?

-- Sandy

Piotr Zalewa

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
http://mooshell.net/bg93L/2

And if you want to use any page outside of your domain you'd have to meet the security guy from AnyBrowser(tm).
If you don't want to use iframe, you'd have use the backend code to retrieve the page via curl and return in the same way from your domain (which is fairly simple).

zalun
--
London, UK
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Thanks a lot for your reply Piotr,

Yes needless to say that its working. But as i said i just want to
refresh only a particular div on my page. so i think i need to use
iframe and that's what i have done. I have put up the code which i
wanted to get refreshes into one file and called it into iframe.

I hope this is good way to do so.

Once again thanks a lot. :)

On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:

> http://mooshell.net/bg93L/2
>
> And if you want to use any page outside of your domain you'd have to meet
> the security guy from AnyBrowser(tm).
> If you don't want to use iframe, you'd have use the backend code to retrieve
> the page via curl and return in the same way from your domain (which is
> fairly simple).
>
> zalun
> --
> London, UK
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
In reply to this post by Piotr Zalewa

Thanks a lot for your reply Piotr,

Yes needless to say that its working. But as i said i just want to
refresh only a particular div on my page. so i think i need to use
iframe and that's what i have done. I have put up the code which i
wanted to get refreshes into one file and called it into iframe.

I hope this is good way to do so.

Once again thanks a lot. :)

On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:

> http://mooshell.net/bg93L/2
>
> And if you want to use any page outside of your domain you'd have to meet
> the security guy from AnyBrowser(tm).
> If you don't want to use iframe, you'd have use the backend code to retrieve
> the page via curl and return in the same way from your domain (which is
> fairly simple).
>
> zalun
> --
> London, UK
Oskar Krawczyk

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Using iFrames is never a good way of doing stuff...

Sent from my iPhone

On 4 Nov 2009, at 09:59, Deepali <[hidden email]> wrote:

>
> Thanks a lot for your reply Piotr,
>
> Yes needless to say that its working. But as i said i just want to
> refresh only a particular div on my page. so i think i need to use
> iframe and that's what i have done. I have put up the code which i
> wanted to get refreshes into one file and called it into iframe.
>
> I hope this is good way to do so.
>
> Once again thanks a lot. :)
>
> On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:
>> http://mooshell.net/bg93L/2
>>
>> And if you want to use any page outside of your domain you'd have  
>> to meet
>> the security guy from AnyBrowser(tm).
>> If you don't want to use iframe, you'd have use the backend code to  
>> retrieve
>> the page via curl and return in the same way from your domain  
>> (which is
>> fairly simple).
>>
>> zalun
>> --
>> London, UK
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Hello Oskar,

Then what we can use to refresh only particular div on the page?

On Nov 4, 3:10 pm, Oskar Krawczyk <[hidden email]> wrote:

> Using iFrames is never a good way of doing stuff...
>
> Sent from my iPhone
>
> On 4 Nov 2009, at 09:59, Deepali <[hidden email]> wrote:
>
>
>
> > Thanks a lot for your reply Piotr,
>
> > Yes needless to say that its working. But as i said i just want to
> > refresh only a particular div on my page. so i think i need to use
> > iframe and that's what i have done. I have put up the code which i
> > wanted to get refreshes into one file and called it into iframe.
>
> > I hope this is good way to do so.
>
> > Once again thanks a lot. :)
>
> > On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:
> >>http://mooshell.net/bg93L/2
>
> >> And if you want to use any page outside of your domain you'd have  
> >> to meet
> >> the security guy from AnyBrowser(tm).
> >> If you don't want to use iframe, you'd have use the backend code to  
> >> retrieve
> >> the page via curl and return in the same way from your domain  
> >> (which is
> >> fairly simple).
>
> >> zalun
> >> --
> >> London, UK
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
In reply to this post by Oskar Krawczyk

Hello Oskar,

Then what we can use to refresh only particular div on the page?

On Nov 4, 3:10 pm, Oskar Krawczyk <[hidden email]> wrote:

> Using iFrames is never a good way of doing stuff...
>
> Sent from my iPhone
>
> On 4 Nov 2009, at 09:59, Deepali <[hidden email]> wrote:
>
>
>
> > Thanks a lot for your reply Piotr,
>
> > Yes needless to say that its working. But as i said i just want to
> > refresh only a particular div on my page. so i think i need to use
> > iframe and that's what i have done. I have put up the code which i
> > wanted to get refreshes into one file and called it into iframe.
>
> > I hope this is good way to do so.
>
> > Once again thanks a lot. :)
>
> > On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:
> >>http://mooshell.net/bg93L/2
>
> >> And if you want to use any page outside of your domain you'd have  
> >> to meet
> >> the security guy from AnyBrowser(tm).
> >> If you don't want to use iframe, you'd have use the backend code to  
> >> retrieve
> >> the page via curl and return in the same way from your domain  
> >> (which is
> >> fairly simple).
>
> >> zalun
> >> --
> >> London, UK
cbolson

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Hi,-
You can use the code that Piotr posted on mooshell - it does exactly
what you are requesting ie it refreshes the contents of a specific
div.
Why isn't this code right for you?
I was taking a look at it and it is really rather cool.  I did
something similar myself recently but used a lot more code to achieve
the same thing :(

Chris

On 4 nov, 11:15, Deepali <[hidden email]> wrote:

> Hello Oskar,
>
> Then what we can use to refresh only particular div on the page?
>
> On Nov 4, 3:10 pm, Oskar Krawczyk <[hidden email]> wrote:
>
> > Using iFrames is never a good way of doing stuff...
>
> > Sent from my iPhone
>
> > On 4 Nov 2009, at 09:59, Deepali <[hidden email]> wrote:
>
> > > Thanks a lot for your reply Piotr,
>
> > > Yes needless to say that its working. But as i said i just want to
> > > refresh only a particular div on my page. so i think i need to use
> > > iframe and that's what i have done. I have put up the code which i
> > > wanted to get refreshes into one file and called it into iframe.
>
> > > I hope this is good way to do so.
>
> > > Once again thanks a lot. :)
>
> > > On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:
> > >>http://mooshell.net/bg93L/2
>
> > >> And if you want to use any page outside of your domain you'd have  
> > >> to meet
> > >> the security guy from AnyBrowser(tm).
> > >> If you don't want to use iframe, you'd have use the backend code to  
> > >> retrieve
> > >> the page via curl and return in the same way from your domain  
> > >> (which is
> > >> fairly simple).
>
> > >> zalun
> > >> --
> > >> London, UK
Deepali-2-3

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink

Hello Chris,

> Why isn't this code right for you?

Its fine for me. but for this i am using iframes and i am showing
flikrs images into that div which i want refresh on click.so the flow
of the images ll be increase time by time.that's the one
reason.Secondly its shows me the path of link on hover which i don't
want to show, i was trying to do for that is-

<a href="#" id="refresh">click</a>

needless to say that its not working.

and third is ,oskar is saying that so wanted to know why is it so?

:)



On Nov 4, 3:20 pm, cbolson <[hidden email]> wrote:
> Hi,-
> You can use the code that Piotr posted on mooshell - it does exactly
> what you are requesting ie it refreshes the contents of a specific
> div.

> I was taking a look at it and it is really rather cool.  I did
> something similar myself recently but used a lot more code to achieve
> the same thing :(
>
> Chris
>
> On 4 nov, 11:15, Deepali <[hidden email]> wrote:
>
> > Hello Oskar,
>
> > Then what we can use to refresh only particular div on the page?
>
> > On Nov 4, 3:10 pm, Oskar Krawczyk <[hidden email]> wrote:
>
> > > Using iFrames is never a good way of doing stuff...
>
> > > Sent from my iPhone
>
> > > On 4 Nov 2009, at 09:59, Deepali <[hidden email]> wrote:
>
> > > > Thanks a lot for your reply Piotr,
>
> > > > Yes needless to say that its working. But as i said i just want to
> > > > refresh only a particular div on my page. so i think i need to use
> > > > iframe and that's what i have done. I have put up the code which i
> > > > wanted to get refreshes into one file and called it into iframe.
>
> > > > I hope this is good way to do so.
>
> > > > Once again thanks a lot. :)
>
> > > > On Nov 4, 1:42 pm, Piotr Zalewa <[hidden email]> wrote:
> > > >>http://mooshell.net/bg93L/2
>
> > > >> And if you want to use any page outside of your domain you'd have  
> > > >> to meet
> > > >> the security guy from AnyBrowser(tm).
> > > >> If you don't want to use iframe, you'd have use the backend code to  
> > > >> retrieve
> > > >> the page via curl and return in the same way from your domain  
> > > >> (which is
> > > >> fairly simple).
>
> > > >> zalun
> > > >> --
> > > >> London, UK
Piotr Zalewa

[Moo] Re: Refresh div

Reply Threaded More More options
Print post
Permalink
In reply to this post by cbolson
@all who wants to ask a question
Please explain in details what do you want to do instead of what is not working.

I.e.
I want to update an empty div on the page using a HTML from the http://example.com/
Like on that page:
How to do that?
Here is how someone else did it: http://search.twitter.com/search?q=helloween
Here is how I tried to achieve the goal, but I failed: http://mooshell.net/bg93L/1

The answer could be
This page (Twitter search is calling a JSON on external site - you could use JSONP for that)
If you want to update a div with the HTML reposne you's meet crossdomain security issue and you would have to load a page in the backend and then load again from that using Request.HTML as on this example: http://mooshell.net/bg93L/2

zalun
--
London, UK