我有以下功能:
$.ajax({url:"http://127.0.0.1:8080", data: "123",
success:
function(response, textStatus, jqXHR)
{
alert(response);
},
error:
function(jqXHR, textStatus, errorThrown)
{
alert("The following error occured: " + textStatus + " " + errorThrown);
}
});
它发送请求,我用“nc -l 8080”拦截一个。看起来像
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
然后我回答
HTTP/1.1 200 OK
Content-Length: 3
abc
问题是我总是出错(“发生以下错误:错误”)你认为它可能有什么问题?