一起学 Microsoft AJAX Library-Sys.Net.WebRequest

作者:vkvi 来源:千一网络(原创) 日期:2009-5-17
function foo(executor, eventArgs) {
    if (executor.get_responseAvailable()) {
        alert(executor.get_statusCode() + "\r\n" +
              executor.get_statusText() + "\r\n" +
              executor.getAllResponseHeaders() + "\r\n" +
              executor.get_responseData());
    }
    else if (executor.get_timedOut()) {
        alert("Timed Out");
    }
    else if (executor.get_aborted())
    {
        alert("Aborted");
    }
}
var request = new Sys.Net.WebRequest();
request.set_url("..process.asp");
request.set_httpVerb("POST");
var body = "id=1&name=jacky"
request.set_body(body);
request.get_headers()["Content-Length"] = body.length
request.add_completed(foo);
request.invoke();

相关阅读

相关文章
文章评论