Consider the function below:
$.ajax({url:"http://127.0.0.1:8080", data: "123",
success:
function(response, textStatus, jqXHR)
{
alert(response);
},
error:
function(jqXHR, textStatus, errorThrown)
{
alert("An error occurred: " + textStatus + " " + errorThrown);
}
});
This function sends a request that I intercept with "nc -l 8080". The intercepted request looks like this:
GET /?123 HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Origin: null
I respond with:
HTTP/1.1 200 OK
Content-Length: 3
abc
The issue is that I always receive an error message ("An error occurred: error"). Can you identify what might be causing this problem?