[jQuery] Re: Jquery load not getting updated pages.....
you can set : $.ajaxSetup({cache: false}) or: $.ajaxSetup({beforeSend: function(e,xhr,s){xhr.setRequestHeader(If-Modified-Since, new Date(0));}}) or: $('#display').ajaxSend(function(e,xhr,s){xhr.setRequestHeader(If-Modified-Since, new Date(0));}).load('../forms/test_form_1.html');
[jQuery] Re: Jquery load not getting updated pages.....
Hey everybody. Thanks for all the help! I am using the $.ajaxSetup({cache:false}) option. It works great. Looks like I need to study up on the ajax functions. Always more stuff to learn! Thanks. Steve On Oct 22, 2:26 am, 汪杰 [EMAIL PROTECTED] wrote: you can set : $.ajaxSetup({cache: false}) or: $.ajaxSetup({beforeSend: function(e,xhr,s){xhr.setRequestHeader(If-Modified-Since, new Date(0));}}) or: $('#display').ajaxSend(function(e,xhr,s){xhr.setRequestHeader(If-Modified-Since, new Date(0));}).load('../forms/test_form_1.html');
[jQuery] Re: Jquery load not getting updated pages.....
Stever wrote on 10/21/2008 11:34 AM: Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Via the headers, have the page expire in the past and set the cache-control headers to no-cache: Expires: Thu, 11 Jun 1998 13:17:30 GMT Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0 Pragma: no-cache Some people instead choose to make the URL dynamic by appending a random query string using the current milliseconds (or something similar). I don't use that method, so maybe someone who does it that way can respond. - Bil
[jQuery] Re: Jquery load not getting updated pages.....
That's not jQuery's fault, check the headers as Bil said or use the query string trick if you need to avoid cacheing. If you use jQuery.ajax() you can also set cache: false as an option. For testing purposes, if you access the loaded page directly the browser will update the cache. IE7 is specially nasty with this, I haven't had this problem with FF. cheers, - ricardo On Oct 21, 2:34 pm, Stever [EMAIL PROTECTED] wrote: Hello, I spent about an hour trying to figure out why a form I was loading to a web page was not updating. In my web page I have a navigation button tool, when I click I want to load a form into the #display div. $(document).ready(function(){ .. a bunch of code. $('#menu li.tool').click(function() { $('#display #product').remove(); $('#menu li[device=device]').removeAttr('clicked'); $('#display').load('../forms/test_form_1.html'); }); .. remaining code }; I call up the page and click the tool button and the form displays no problem. However, later I made changes to the form (test_form_1.html) and they were not included, even after refreshing the page. I even removed the html file and it still loads! Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Steve
[jQuery] Re: Jquery load not getting updated pages.....
Thanks for the message. Now I'll show you how new I am at this stuff. :-) How do I update the headers. Apparently this is done from the server side. Do I need to do something with the load function, (I know you said I could add a random query statement to the URL in the load), but obviously that's not updating the headers. Do I have to do something with the HTML page itself that I am loading. I am confused because it seems like the HTTP headers and between the load and the HTML page. Thanks again for your help. Stever On Oct 21, 1:01 pm, Bil Corry [EMAIL PROTECTED] wrote: Stever wrote on 10/21/2008 11:34 AM: Apparently this file is saved in the cache, how do I make sure everytime I click on the tool button I get the latest page? Via the headers, have the page expire in the past and set the cache-control headers to no-cache: Expires: Thu, 11 Jun 1998 13:17:30 GMT Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0 Pragma: no-cache Some people instead choose to make the URL dynamic by appending a random query string using the current milliseconds (or something similar). I don't use that method, so maybe someone who does it that way can respond. - Bil
[jQuery] Re: Jquery load not getting updated pages.....
Stever wrote on 10/21/2008 6:33 PM: How do I update the headers. Apparently this is done from the server side. It depends on your server-side language and web server. Apache can set headers using mod_headers: http://httpd.apache.org/docs/2.0/mod/mod_headers.html#header Depending on your server-side language (Lasso, PHP, Python, Perl, etc) you'd have to look it up as it differs per language. I know you said I could add a random query statement to the URL in the load You can do that instead of setting the headers. Might be easier if you're unsure of how to set response headers. - Bil
[jQuery] Re: Jquery load not getting updated pages.....
Bil, Thanks for the help. I think I can figure it out from here.I have several options The server is Apache and I am using perl cgi on the server. However the confusion I have is that on the Jquery load you aren't using the server get/post methods. You just give it a URL. And the page I am loading static (pre-built) , well it's a form that as a get/post method embedded in it. But the form itself is just a static html file. Anyway I appreciate the help. Thanks! Steve On Oct 21, 6:39 pm, Bil Corry [EMAIL PROTECTED] wrote: Stever wrote on 10/21/2008 6:33 PM: How do I update the headers. Apparently this is done from the server side. It depends on your server-side language and web server. Apache can set headers using mod_headers: http://httpd.apache.org/docs/2.0/mod/mod_headers.html#header Depending on your server-side language (Lasso, PHP, Python, Perl, etc) you'd have to look it up as it differs per language. I know you said I could add a random query statement to the URL in the load You can do that instead of setting the headers. Might be easier if you're unsure of how to set response headers. - Bil