• λ我爱Aspx >> C#.Net >> 用.net 处理xmlHttp发送异步请求_ASP.NET技巧
  • 用.net 处理xmlHttp发送异步请求_ASP.NET技巧

  • :aspxer  Դ:internet  :2007-4-28 23:46:58  ؼ:.net,asp.net,asp,xml
  • xmlHttp对象

    /**//*

    url-loading object and a request queue built on top of it

    */

    /**//* namespacing object */

    var net=new Object();

    net.READY_STATE_UNINITIALIZED=0;

    net.READY_STATE_LOADING=1;

    net.READY_STATE_LOADED=2;

    net.READY_STATE_INTERACTIVE=3;

    net.READY_STATE_COMPLETE=4;

    /**//*--- content loader object for cross-browser requests ---*/

    net.xmlHttp=function(url, onload, params, method, contentType, onerror){

    this.req=null;

    this.onload=onload;

    this.onerror=(onerror) ? onerror : this.defaultError;

    if(typeof(method) == "undefined" || method == null)

    {

    method = "POST";

    }

    this.loadXMLDoc(url, params, method, contentType);

    }

    net.xmlHttp.prototype.loadXMLDoc=function(url, params, method, contentType){

    if (!method){

    method="GET";

    }

    if (!contentType && method=="POST"){

    contentType='application/x-www-form-urlencoded';

    }

    if (window.XmlHttpRequest){

    this.req=new XmlHttpRequest();

    } else if (window.ActiveXObject){

    this.req=new ActiveXObject("Microsoft.xmlHttp");

    }

    if (this.req){

    try{

    var loader=this;

    this.req.onreadystatechange=function(){

    net.xmlHttp.onReadyState.call(loader);

    }

    this.req.open(method,url,true);

    if (contentType){

    this.req.setRequestHeader('Content-Type', contentType);

    Ҷƪл˵?
  • һƪxmlHTTP xmlDOC 与 C#中DataSet的结合 实现AJAX简单示例_Ajax
    һƪAjax核心:XMLHTTP组件相关技术资料_Ajax