I need to change a part of my web page content dynamically without refreshing the entire page. Like Myspace or Facebook users gallery.
Does anybody know of any useful scripts with a working back button and changing address URL accordingly?
I need to change a part of my web page content dynamically without refreshing the entire page. Like Myspace or Facebook users gallery.
Does anybody know of any useful scripts with a working back button and changing address URL accordingly?
If it is a simple update I'd user jQuery to periodially poll something in the background and update the page accordingly.
setTimeout(poll, 10000); // every 10 seconds
function poll(){
$.get('my_url_returns_a_chunk_of_html', myCallback);
}
function myCallback(data, textStatus){
$('#somediv').html(data); // just replace a chunk of text with the new text
setTimeout(poll, 10000);
}
This could be a lot better and handle when the text hasn't changed and error handling etc but is a start.
If you need it to be instant your looking at Comet but in general it adds a lot of complexity so I'd stay away out of simplicity.