15
votes

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"):

enter image description here

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.

1

1 Answers

18
votes

"Firebug color codes requests that are served from the cache in a lighter gray..."

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.