5

Hi i'm looking for a tutorial for understand how i can create a page with a div that isn't refreshed when the page url changes.

Ex. The facebook chat isn't refreshed when i move from an url to another.

Thanks

Tauren
  • 26,795
  • 42
  • 131
  • 167
Luca Romagnoli
  • 12,145
  • 30
  • 95
  • 157
  • 1
    With the new HTML5 `history.pushState` it might no be so obvious anymore, that Ajax is used. But whenever only part the page is refreshed, it is definitely Ajax (or iframes). – Felix Kling Dec 31 '10 at 12:04
  • @Felix +1 -- I'm guessing that's what they are doing too – Tauren Dec 31 '10 at 12:55

3 Answers3

1

AJAX is definitely being used, although it may not seem like it because the actual URL is changing. Most AJAX apps just change the hash part of the URL (somesite.com/page/#feature1).

I don't know exactly what Facebook is doing as I haven't studied the app, but I would guess that they are using HTML5 history.pushState() to change the URL so that if you bookmark it or reload, it will go to the same place. I see that @Felix already mentioned this in a comment.

Take a look here for more help:

Is there a way to change the browser's address bar without refreshing the page?

There are lots and lots of resources on using AJAX. I personally use jQuery and find that it makes much of this quite easy. Here's a tutorial that might help:

http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/

Community
  • 1
  • 1
Tauren
  • 26,795
  • 42
  • 131
  • 167
0

Sounds like you are wanting to use AJAX (javascripts XMLHttpRequest function). here is a great article on it along with some basic examples: Here

Exoas
  • 181
  • 6
0

It's called AJAX, if you use jQuery, here's a good tutorial:

http://yensdesign.com/2008/11/creating-ajax-websites-based-on-anchor-navigation/

I wanted to post another examples if you dont use jQuery but i need more points to post more than one link, sorry...

Javis Perez
  • 4,130
  • 3
  • 23
  • 27