Reputation: 283
I know this question has probably been answered over 200 times and I have surfed stackoverflow for the last 2 hours now trying every solution possible so I guess I will fire away here..
I have a partial view that looks like this.
@using DatabaseEntities;
@using NJNightLifePortal.Models;
@model NJNightLifePortal.Models.StatisticsViewModel
@foreach (var item in Model.RecentlyLiked)
{
<div class="resultbox1">
@Html.ActionLink(item.Username, "profile", "account", new { id = item.Username }, null)
has recently liked @Html.ActionLink(item.VenueName, "venueprofile", "venue", new { id = item.VenueId, albumId = Utils.GetVenueDefaultAlbumIdByVenueId(item.VenueId) })
</div>
}
I am then calling a jqery ajax function on this via setTimeout as shown below.
$(function () {
setTimeout(
function () {
setInterval(RefreshStats, 2000);
RefreshStats();
}, 3000);
function RefreshStats() {
$.get('@Url.Action("LatestActivities", "Statistics")', function (data, status) {
console.log(data);
$('.resultbox1').html(data);
});
}
I have tried $.load
, $.ajax
as well.. I have also tried document.getElementById(element).innerHTML = data;
and I have still got the same results. Every single one of the aforementioned conventions work great in firefox and chrome but no matter what I do with IE it either ends up refreshing with blank results or recreating a totally new div that is not even returned by the partial view.
Please ask or request whatever I am trying to figure this out and would love to have a solid fix and not a hack fix unless it's neccessary. All I am trying to do is retrieve some db results and display them as they are formatted in the partial view back into the div called resultbox1.
Thank you so much in advance.
Upvotes: 0
Views: 480
Reputation: 1038800
Maybe IE caches the responses (which is normal for GET requests, it's just that IE is a little more aggressive in that respect). Things to try:
LatestActivities
controller action with a custom [NoCache]
attribute$.get
with $.post
$.get
with $.ajax
and set the cache: false
optionUpvotes: 1