I'm trying to debug some tricky behaviour in my web application: It appears as though an XHR GET request is being sent by the client, but the server never actually receives it. Furthermore, the client seems to receive duplicate data in the unseen request as the previous XHR request it sends.
Further confounding matters, Firebug colors the second XHR request as light gray in the Net panel (the request here is third from the bottom, the second "GET test"):
I haven't been able to find any documentation about what this coloring means. I think if I understood this, it might help explain this unusual behaviour.
If anyone has any insight, I'd appreciate if you could let me know.
So the reason the server doesn't see the request is that the client never actually sends it, it simply receives the response from its cache. If you're using jQuery, there is a cache property that you can use on ajax() to prevent AJAX requests from being cached. If you're not using jQuery you can append a dummy parameter to the end of the request URL that has a value of the current time in milliseconds (this is in fact what jQuery does I believe).
url + "?v=" + (new Date()).getMilliseconds()
This should ensure the URL is always unique and prevent the browser from using caching.
©2020 All rights reserved.