我将一些用户的数据存储在cookie中,然后将所有数据附加到表中:
$.ajax({
url: "http://127.0.0.1:8000/recent/",
dataType: 'json',
type: 'get',
cache:false,
success: function(data){
var recent = JSON.parse(data['recent']).reverse();
$('.container').append(get_table(recent));
},
error: function(d){
alert("404. Please wait until the File is Loaded.");
}
});
所以我的问题可能有点愚蠢,但是每次我更改cookie中的数据时都不会刷新我的表,因为我使用ajax获取它 .
1 回答
不,每次更改cookie中的数据时都不会刷新 . 那是因为您只附加了收到的第一个数据并保存在cookie中 .
如果要在每次更改cookie中的数据时刷新表,则需要创建一个监听器,告诉您数据已更改 .