我有一个 mvc 3 razor 项目,在 PC 上运行得很好,但在 iPad 上有一个问题,我有一个文章列表和一个用于测试的添加按钮,然后我按添加按钮,它现在返回日期时间,然后我按添加的按钮是返回日期时间,然后我按第二次它返回相同的日期时间,我在 iPad 上的项目是从缓存中获取值我想,每个人都可以帮助我吗??? 这个jquery代码:
$(document).ready(function (){
$(".AddButton").live("click", function(){
var buttonId = $(this).attr("id");
var id = buttonId.substr(buttonId.indexOf("_"));
$.ajax({
type:'POST',
dataType:'json',
url: "@Url.Action("AddCommandArtikelJson","Home")",
data: {id:$("#Id"+id).val(), id_priceOnPad: $(this).attr("name")},
cache: false,
success: function(result){
$("#commandsCount").text(result);
}
});
});
});
这个 Controller 功能:
[HttpPost]
public JsonResult AddCommandArtikelJson(int id, int id_priceOnPad)
{//my code
return Json(DateTime.Now);
}
最佳答案
这种情况下的一个常见技巧是在查询字符串中传递一个随机字符串,这会诱使浏览器认为请求不同,从而绕过缓存。
关于jquery - ajax 请求在 kiosk 浏览器上缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13006630/