ajax请求get自动添加时间戳

348 阅读1分钟
$.ajax({
    url:'http://www.com',
    type: 'GET',
    dataType: 'json',
    data: {},
    headers: {
        Token: token
    }, 
    async: true,
    cache: false,
    success: function(res){
        console.log(res.data)             
    },
    error: function(error){
        console.log(error)
    }
})

使用ajax请求过程中发现除了请求本身需要的参数之外的其他参数

image.png

通过将ajax的属性cache设置为true来阻止请求中携带时间戳, 向服务器发送请求