jQuery AJAX producing 304 responses when it shouldn't

前端 未结 3 1287
粉色の甜心
粉色の甜心 2020-12-14 06:53

This really has me scratching my head. Namely because it only happens in IE, not Firefox, and I was under the impression that jQuery was effectively browser neutral. I\'ve b

3条回答
  •  悲哀的现实
    2020-12-14 07:29

    Cache busting is the solution!

    In my case the application used a single service call with a custom header as a proxy to bridge the browser to the private part of the server (every call went to the same url, but used a custom header to tell the proxy service which service to pass it onto). Everything worked fine on Chrome and FF but IE kept returning data from the first call made on the page. cache=false option in jQuery.ajax was the fix since IE just looked at the same url being called, didn't even bother looking at whether any custom headers were used, or whether different data was even being passed in the body, and just said "oh, I know this one, here.." and gave back the response of the first call. With the cache busting technique the url looks different to IE so it sent it through.

提交回复
热议问题