jQuery AJAX + ASP.NET ( ASHX ) – IE 9 about No Data Caching
jQuery |
$.ajax({ url: "restful.ashx?rnd=" + obj.rnd + "&id=" + obj.id, type: "POST", data: JSON.stringify(obj), contentType: 'application/json; charset=utf-8', success: function (data) { for (var key in data) { if (data.hasOwnProperty(key)) { for (var keyitem in data[key]) { selectbox.append(OptionCtlAdd(keyitem, data[key][keyitem])); } } } } }); |
ASHX |
public class Role : IHttpHandler { public void ProcessRequest(HttpContext context) { JArray ary = new JArray(); … … context.Response.Expires = -1; context.Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-1)); context.Response.Cache.SetValidUntilExpires(false); context.Response.Cache.SetRevalidation(System.Web.HttpCacheRevalidation.AllCaches); context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); context.Response.Cache.SetNoStore(); context.Response.ContentType = "application/json"; context.Response.Write(ary.ToString()); } … … } |