JavaScript Javascript HTTP请求v1.0

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Javascript HTTP请求v1.0相关的知识,希望对你有一定的参考价值。

/* Wrapper function for constructing a Request object.
 Parameters:
  reqType: The HTTP request type such as GET or POST.
  url: The URL of the server program.
  asynch: Whether to send the request asynchronously or not. */
function httpRequest(reqType,url,asynch){
    //Mozilla-based browsers
    if(window.XMLHttpRequest){
        request = new XMLHttpRequest();
    } else if (window.ActiveXObject){
        request=new ActiveXObject("Msxml2.XMLHTTP");
        if (! request){
            request=new ActiveXObject("Microsoft.XMLHTTP");
        }
     }
    //the request could still be null if neither ActiveXObject
    //initializations succeeded
    if(request){
       initReq(reqType,url,asynch);
    }  else {
        alert("Your browser does not permit the use of all "+
        "of this application's features!");}
}

以上是关于JavaScript Javascript HTTP请求v1.0的主要内容,如果未能解决你的问题,请参考以下文章

提交时的 Javascript 表单

Javascript 中的重映射或映射函数

javascript动画中的定位

使用 Javascript 与 SOAP API 对话

JavaScript表单验证中文大写字母

代码收藏系列--javascript--移动端技巧