How to prevent ajax requests to follow redirects using jQuery

前端 未结 9 604
梦如初夏
梦如初夏 2020-11-27 14:37

I use the jQuery ajax functions to access a web service, but the server, instead of returning a response with a status code describing a problem, the request is redirected t

9条回答
  •  -上瘾入骨i
    2020-11-27 15:12

    I suppose you receive a 200 response because the second time there is no redirection, because the 404 page does not expire, it is saved in the cache. That is to say that the second time the browser gives you the page in the cache. There is a property "cache" in the ajax jquery. http://api.jquery.com/jQuery.ajax/

    You should write it to "false"

提交回复
热议问题