Reputation: 675
I have a following javascript function mixed with MVC controller actions calls:
var loadPartialChapterAfterAnswer = function () {
$.ajax({
url: '@Url.Action("IsAuthenticated", "Story")',
type: "POST",
success: function(data) {
var isAuthenticated = data;
if (isAuthenticated) {
if ('@Model.IsPersonality' == 'True') {
loadPartialChapter();
} else {
$("#chapterContainer").load('@Url.Action("GetNextQuestion", "Story")' + '?storyId=' + '@Model.Id', function () {
selectedCounter = 0;
showOnlyOneQuestion();
});
}
} else {
window.location.href = '@Url.Action("RedirectToHomeRoute", "Home")';
}
},
error: function() {
alert("Error");
}
});
};
Every time I select one checkbox on my page(view) this function is called. Code works great in all browsers except in IE. In IE the ajax url @Url.Action("IsAuthenticated", "Story")
is called OK every time, but the other controller action '@Url.Action("GetNextQuestion", "Story")' + '?storyId=' + '@Model.Id'
is called only when the IE's browser debugger is turned on. When IE's debugger window is off this second MVC action is never called.
Any help is highly appreciated!
SOLUTION
I added at the beginning of my page this code:
<script>
$.ajaxSetup({
cache: false
});
</script>
and now it works! Thanks all for your effort.
Upvotes: 3
Views: 2066
Reputation: 8781
I read something about IE having issues with JQuery load function
Try to replace it with regular $.ajax
with cache: false
option hopefully it will resolve the issue.
Check this topic
Upvotes: 2
Reputation: 8539
Add controller to this: @Url.Action("GetNextQuestion")' Without controller specified it place controller which return view last.
Upvotes: 0