Hello,
I have a simple proof of concept that seems to be handling caching oddly. Here's the view:
<script>
$('#clickToLoad').click(function() {
$.ajax({
url: "<%=ResolveUrl("~/Home/AjaxCacheTest") %>?"
, dataType: 'json'
,ifModified: true
,cache: true
,success: function(sourceData) {
}
});
});
</script>
This is linked to an action in the controller:
[OutputCache(VaryByParam = "none", Duration = 3000)]
public ContentResult AjaxCacheTest()
{
return Content("0", "application/json");
}
I'd like to get a result with caching, however, it seems that AjaxCacheTest doesn't cache unless I request it on its own (that is, in a browser window, instead of AJAX).
Setting cache: true doesn't help. Setting ifModified: true does cause caching, but then it doesn't call the success function, so I can't use the results.
Are there any options that allow caching and still call the response callback?
UPDATE: Thanks, forgot to add those. I'm testing with firebug and determining how caching is handled by a combination of looking at the response code (200 OK vs 302) and the response time for the request. This is all on Visual Studio's built in server (Cassini?).