I'm using codeigniter, I am curious about the get query for long polling I made
function check_new_notif(){
$.ajax({
type:"GET",
url:"/MAIN/AJAX/new_unotif",
async:true,
cache:false,
datatype: "text",
timeout:20000,
success: function(dat){
show_new_notif(dat);
fetch_new_notif();
setTimeout(
check_new_notif,10000
);
},
error: function(XMLHttpRequest,textstatus,errorThrown){
show_new_notif("error");
setTimeout(
check_new_notif,10000
);
}
});
what is the number used for? when my long polling request on server the links in firebug was like this
GET /MAIN/Ajax/notification?_=1466062273034
and the next call its /MAIN/Ajax/notification?_=1466062273035
,incremented by one
Anyone know what this ?_=1466062273035
query means?
Thankies
When you set cache: false
, it will append timestamp to your URL
Doc: http://api.jquery.com/jquery.ajax/
If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.