jQuery (or maybe the browser) is cache-breaking ajax loaded scripts
I'm loading a view page via an $.ajax()
call with jQuery. I'm explicitly setting the "cache" option to true. Nowhere in the application are we using $.ajaxSetup()
to specify otherwise.
Here's the ajax request setup:
$(".viewDialogLink").click(function() {
$.ajax({
url: $(this).attr("href"),
dataType: "html",
type: "GET",
cache: true,
success: function(data) { $("#dlgViews").html(data).dialog("open"); }
});
return false;
});
The response comes back successfully. The dialog opens, and some content displays.
HOWEVER
There are script tags in the returned html. For example:
<script type="text/javascript" src="http://../jsapi/arcgis/?v=1.4"></script>
Now - in the response text, these look normal. But the actual browser requests for these scripts, as seen from FireBug, include a cache-breaker parameter in the query string. They look like:
http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.4&_=1264703589546
.
None of the other resources in the loaded html - css or images - include the cache breaker in their reques开发者_Python百科t.
What is going on? How do I turn this cache breaker off?
I was able to replicate your issue on my test server. I then changed from jquery 1.3.2 to 1.4.1. With Jquery 1.4.1 it doesn't add the cache-breaking string.
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
Of course, using 1.4.1 might not be an option for you.
精彩评论