嗨,我的数据表ajax调用如下,
$(document).ready(function () {
$('#example').DataTable({
"ajax": '/api/get_requests'
});因此,我期望调用我的后端django服务器如下所示,
http://localhost:8080/api/get_requests/但相反,它最终生成一个额外的随机数,调用如下所示,而我的django服务器说的是错误的url,并给出404错误
http://localhost:8080/api/get_requests/?_=1511021359038如何才能强迫datatable ajax调用不发送额外的随机数?
发布于 2017-11-19 10:31:29
这不是随机数,而是时间戳,上面的内容转化为Sat Nov 18 2017 17:09:19 GMT+0100 (CET)。
这只是jQuery AJAX缓存的工作方式,它为请求添加了时间戳,以欺骗浏览器尝试缓存所有内容。我相信
$('#example').DataTable({
ajax: {
cache: false,
url: '/api/get_requests'
}
});会解决这个问题。
https://stackoverflow.com/questions/47369756
复制相似问题