PHP + Jquery + Ajax auto refresh DIV

February 8, 2009 in Ray by danke

jQuery is cool , Really !

Ajax.js
[source language='js']
var _v = 0;
var _v2 = 1;
function ajax_update()
{
var wrapperId = ‘#content’;
var postFile = ‘jquery.php’;
_v++;
_v2++;
$.post(postFile, { v2: _v2 , v: _v}, function(data){$(wrapperId).slideUp(‘2000′,function(){$(this).html(data).slideDown();}).html();});
setTimeout(‘ajax_update()’, 6000);

}
[/source]
check the demo here.

Download the script here.

  • Share/Bookmark