I'm trying to make an AJAX request with dataType: "json"
and I'm Firebug keeps showing the request as "aborted."
POST http://mydomain.com/path/to/page Aborted
This is the snippet:
var postData = "someVar=someValue&otherVar=otherValue", msg;
$.ajax({
type: "POST",
url: "/path/to/page",
data: postData,
dataType: "json",
cache: false,
success: function(response) {
if (typeof response.row != undefined) {
$('#my-select')
.append($('<option></option>')
.attr("value", response.row.id)
.text(response.row.name)
);
msg = response.msg;
} else {
msg = 'failed';
}
alert(msg);
},
error: function(xhr, status, thrown) {
// EDIT 1
alert(status); // <-- It's alerting "timeout"
}
});
Incidentally, I read a bunch of questions on this site of people with similar issues, but may of them turned out to be very specific. One was because the request was too large, another was because they were requesting to another domain, etc etc.
I get no response headers and no response body.
Here are my request headers (simplified):
Host mydomain.com
User-Agent Firefox/8.0.1
Accept application/json, text/javascript, */*; q=0.01
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
DNT 1
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Referer http://mydomain.com/path/to/page
Content-Length 125
Cookie PHPSESSID=somerandomstring
Nothing shows up in the Apache error_log. I navigated manually to that page in the browser and I didn't get any errors (just a white screen and some text).
NOTE: This works on my localhost but not on the testing server.
Edit: Added error()
callback and it's alerting "timeout."