Take a look at this site http://tinyurl.com/xhrexample and
- pick a size in the select box titled “Vælg størrelse”
- push the “LÆG I INDKØBSKURV” button
Now 3 requests are fired
- POST cart.actions.php
- GET /produkter/(…)
- GET /kurv/?forajax
I have 2 questions:
- I wonder where the second event comes from. XHR Breakpoints in Chrome does not break on the 2nd event. This is a customization of an existing system, so I don’t know everything about how it is constructed.
- Sometimes (in unlucky cases?) not all requests are made. This is very hard to debug – any ideas?
Well, the POST request causes a response with code
302 Found. ALocationheader is sent along redirecting to another page, namely/produkter/..., which is therefore the second request made. This resource, in turn, contains the following JavaScript code on line 308:which makes for the third request.