I'm not the most knowledgeable when it comes to AJAX so I'm having a very difficult time debugging what I would think would be a very simple AJAX request. The request sends data to a URL via GET and is supposed to either be returned a 1 or 0. Instead nothing is returned and the error message is blank. The confusing part for me is that I can copy and paste the URL along with the url encoded variables (so just like what it would be if I submitted a form with the GET method) and the remote server will return a 1 or a 0 just fine.
Firebug does not show that any errors were thrown either. All I can see from it was that the request was made, the right params and associated values were passed and that the html is completely blank.
EDIT : This is not browser specific. Tested in Firefox, IE, and Chrome.
Code:
var userData = {
firstname: $('#firstname').val(),
lastname: $('#lastname').val(),
addr1: $('#addr1').val(),
ct: $('#ct').val(),
stateprovince: $('#stateprovince').val(),
zipcode: $('#zipcode').val(),
primary_phone: $('#primary_phone').val(),
gradyear: $('#gradyear').val(),
school_id: $('#school_id').val(),
source_id: $('#source_id').val()
}
$.ajax({
type: "GET",
url: "http://blahblahblah.com/blah",
data: userData,
success: function() {
alert("it worked!");
},
error: function(xhr,err){
alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
alert("responseText: "+xhr.responseText);
}
});
The error alerts return:
readyState: 0
status: 0
and
repsonseText:
Any help would be greatly appreciated! I'll respond back as fast as I can if any additional info is requested!