jquery ajax post 返回,javascript – jquery如何获取ajax调用类型post返回的状态消息?...
JavaScript的
$('#send').on('click',function() {
$.ajax({
'url': $('#url').val(),'type': 'post','complete': function (jqXHR,textStatus) {
var msg = "Status: " + jqXHR.status + " (" + jqXHR.statusText + " - " + textStatus + ")
";
msg += jqXHR.getAllResponseHeaders().replace(/\n/g,"
");
$('#results').html(msg);
}
});
});
header("HTTP/1.0 200 Some message here");
flush();
exit();
结果
Status: 200 (OK - success)
Date: Wed,07 Dec 2011 21:57:50 GMT
X-Powered-By: PHP/5.3.6
Transfer-Encoding: chunked
Connection: Keep-Alive
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
Content-Type: text/html
Keep-Alive: timeout=5,max=100
题
如何获取“某些消息在这里”部分的标题?
HTTP
6.1 Status-Line
The first line of a Response message is the Status-Line,consisting of
the protocol version followed by a numeric status code and its
associated textual phrase,with each element separated by SP
characters. No CR or LF is allowed except in the final CRLF sequence.
06003