[英]Browser cache issue in IE
I have this JavaScript code: 我有以下JavaScript代码:
$('#selectionoptions').change(function() {
var courseId = $(this).val();
$.get('../php/lecturer_getcourse_info.php',
{ course_id: $(this).val() },
function(courseData) {
var description = courseData.description;
$("#coursecontent").html(description);
...
Assume I can also modify 'description' and save it back to the db. 假设我还可以修改“描述”并将其保存回数据库。 Now, on Firefox every time I refresh the page I see the correct description;
现在,在Firefox上每次刷新页面时,我都会看到正确的描述; but on IE I have to clear the cache before I see the correct description....
但是在IE上,我必须先清除缓存,然后才能看到正确的说明。...
How can I fix this? 我怎样才能解决这个问题?
The reason being in IE you have to false the Ajax Calls not to cache. 原因是在IE中,您必须将Ajax调用设为不缓存。
Use this: 用这个:
$.ajaxSetup({
// Disable caching of AJAX responses
cache: false
});
or use a completely different ajax call rather than $.get such as: 或使用完全不同的ajax调用而不是$ .get,例如:
$.ajax({
url: "test.html",
success: function(data){
alert('data returned!');
},
cache: false
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.