任何人都可以看到以下現象嗎?瀏覽器JQUERY數據緩存IE7
我有目標平臺IE7
上運行的ASP.NET MVC應用程序如果我輸入一個記錄到數據庫中,然後導航到包含HighChart圖形輸入的數據並不代表一個ASPX頁面。我必須關閉瀏覽器並重新加載應用程序才能使數據顯示在圖表中。
我在調試模式下運行應用程序,代碼沒有命中控制器中的斷點。它就好像客戶端的JQUERY代碼認爲沒有變化並且正在緩存。控制器甚至不會啓動,但應用程序運行時會像處理舊數據一樣運行。
當我重新加載應用程序(停止並啓動)控制器的火災,我可以調試和最新的數據來自於
瘋狂的事情,必須有一個設置也許是web.config文件或地方,以保證客戶端JSON電話始終會轉到這個控制器和緩存不
如果需要,下面大加讚賞
Ĵ
代碼中的任何意見:
function CreateChart1(surl) {
// Code block for fetching Array as jsonResult (js)
var url = $("#AbsolutePath").val() + "Incident.mvc/GetChartData_IncidentsBySiteStatus/" + surl;
var chart;
$.getJSON(url, null, function(data) {
var result = [];
jQuery.each(data, function(i, val) {
result[i] = [val.Site, parseInt(val.Count)];
});
chart = new Highcharts.Chart({
chart: {
renderTo: 'chart1',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Number of Environmental Incidents by Site Status'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y + ' (' + Math.round(this.percentage) + '%)';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true
},
showInLegend: false
}
},
exporting: {
enabled: true
},
series: [{
type: 'pie',
name: 'Incidents by Site Status',
data: result
}]
});
});
};
控制器代碼:
public JsonResult GetChartData_IncidentsBySiteStatus(string SiteTypeId, string searchTextSite, string StartDate, string EndDate)
{
if (searchTextSite == null)
searchTextSite = "";
DateTime startDate = DateTime.Parse(StartDate);
DateTime endDate = DateTime.Parse(EndDate);
IQueryable<Site> sitesQry = _db.Sites;
if (SiteTypeId != "-1")
sitesQry = sitesQry.Where(a => a.SiteTypeId.ToString() == SiteTypeId);
var qry = from i in _db.Incidents
join s in sitesQry on i.SiteId equals s.SiteId
where s.SiteDescription.Contains(searchTextSite)
&& (i.Raised >= startDate && i.Raised <= endDate)
group s by s.SiteStatus.SiteStatusDescription + "[" + s.SiteTypeId.ToString().Replace("1","ON").Replace("0","OFF") + "]"
into grp
select new
{
Site = grp.Key,
Count = grp.Count()
};
return Json(qry.ToList() , JsonRequestBehavior.AllowGet);
}
http://stackoverflow.com/questions/264216/getjson-returning-cached-data-in-ie8這可能會有所幫助 – Rafay