Just getting into ajax using MVC3. I am having weird behavior with IE8. The code in my view:
@Ajax.ActionLink("Get Latest Server Time",
"ServerTime",
new AjaxOptions() {UpdateTargetId = "serverTime",
InsertionMode = InsertionMode.InsertAfter,
HttpMethod = "GET",
LoadingElementId = "progress",
});
<div id="serverTime">
</div>
<div id="progress">
In Progress.....
</div>
In IE8 it works perfectly the first time you click on the link (actionlink). The action link is just simply getting the sever time. Ever subsequent call it just uses the value you got from the sever originally (time) and doesn’t go back to the server. So if the first time you clicked the link it was 1:24:36 PM then even if you click the link 15 minutes later it will still display the same time.
I thought maybe it was my novice understanding of ajax but then i tried chrome & firefox and everything is working as expected. Maybe IE9 works correctly but i’m not sure because i’m running XP. Does anyone know whats going on?
IE in general caches get requests. It can be a real pain when debugging Ajax requests. The easiest method to fix your issue is to change HttpMethod = “GET” to HttpMethod = “POST”, you will just have to make sure your Action accepts posts.