请问ajax请求发出的数据怎么多了一段数字

图片描述

为什么我的ajax会多一串数字

阅读 3k
2 个回答

对于type为 'script' 和 'jsonp'的请求,jQuery 会附带这一个参数来阻止浏览器缓存

http://api.jquery.com/jquery.ajax/

cache (default: true, false for dataType 'script' and 'jsonp')
Type: Boolean

If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.

如果你不想要这个参数,设置 cache: true

这个是服务端的问题,返回的数据就带的,是服务端配置问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题