Hello,
I am using jQuery to submit the contents of an HTML form to a server-side PHP file, via POST request.
The server-side PHP script processes the POST request and sends a location header when it's finished, a la
header('location:' . 'https://localhost/project/?method=edit&id=26&success=true');exit;In Firebug's Console tab, I see something like the following:
POST https://localhost/project/ 302 Found 231ms
GET https://localhost/project/?method=edit&id=26&success=true 200 OK [spinning wheel indefinitely] 235msI'm a bit confused in several places here.
1.) My understanding is that jQuery AJAX requests will follow all redirects before returning a response. It is therefore curious that the Response tab for the
first (POST) request returns the markup that
should be returned in the second (GET) request (and the GET request returns absolutely nothing in the Response tab). This seems backwards. The first request should return nothing (after all, PHP cannot send markup before calling header()), and the second request should return the markup that is being displayed under the first request's Response tab.
2.) How is it that Firebug is able to display the request completion time for the GET request (235ms in the above example), yet the spinning wheel graphic never disappears (seemingly indicating that the request has not finished)?
3.) For the same series of requests, the Net tab displays the following:
POST https://localhost/project/ 302 Found 231ms 20BGET https://localhost/project/?method=edit&id=26&success=true 200 OK 235ms 1.1KBThe timeline appears to be complete, which contradicts the spinning wheel graphic on the Console tab. And again, how can the response size be displayed if the wheel is still spinning on the Console tab (for the GET request)? Finally, why is the size of the first response only 20B and the size of the second response 1.1KB? This contradicts the fact that the Console -> Response tab for the first request contains all of the markup that is returned, and the Response tab for the second request contains nothing. Again, these sizes appear to be reversed.
4.) If I call alert() in the AJAX POST request's "success" callback function, the alert is indeed fired, but it happens before the redirect to the second URL is followed.
Am I misunderstanding that nature of Firebug as it relates to AJAX requests?
Thank you for any help.