Welcome Guest, Not a member yet? Register   Sign In
Clear Cache When made an Ajax Request?
#1

[eluser]rajeshkumar[/eluser]
Hi to All,
I Created one page with two tabs loading the data through ajax only, first tab contains form with some input fields, when i update the form through ajax it is updating in the database. When i click the second tab and again come back to first tab it is showing old data only but not showing new data. So the problem is that it showing the data from cache... how to clear the cache memory? When made an Ajax Request...

Anyone, Can Help me ...
#2

[eluser]n0xie[/eluser]
Add a timestamp to your Ajax Request, so it won't cache the response.
#3

[eluser]rajeshkumar[/eluser]
Thanks nOxie.
But i am using jquery with ajax in CodeIgniter and having controllers and models, So how can we add timestamp to the url.

This is i am using for ajax request.

$.ajax({
type: "POST",
url: site_url+'/sample_c/showForm/',
data:'',
dataType: "html",
success: function(msg){
$("#show_form").html(msg);
},
error: function(){
$.fn.colorbox({width:"76%", transition:"fade", title:"User Information", html:"Sorry! Browser failed to send your request. Please try again!!"});
}
});
#4

[eluser]n0xie[/eluser]
Code:
var timestamp = Number(new Date()); // current time as number


  url: site_url+'/sample_c/showForm/'+timestamp,




Theme © iAndrew 2016 - Forum software by © MyBB