function getXMLHttpRequest() {  
              var xhr;  
              if(window.ActiveXObject) {  
                       xhr= new ActiveXObject("Microsoft.XMLHTTP");  
              }else if (window.XMLHttpRequest) {  
                       xhr= new XMLHttpRequest();  
              }else {  
                       xhr= null;  
              }  
              return xhr;  
    }  
      
    function save() {  
              var xhr = getXMLHttpRequest();  
              xhr.open("post","url");  
              var data = "name=mikan&address=street...";  
              xhr.send(data);  
              xhr.onreadystatechange= function() {  
                       if(xhr.readyState == 4 && xhr.status == 200) {  
                                alert("returned:"+ xhr.responseText);  
                       }  
              };  
    } 

 

相关文章:

  • 2021-11-06
  • 2022-12-23
  • 2022-02-08
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
  • 2021-06-02
  • 2021-06-22
猜你喜欢
  • 2021-11-27
  • 2021-11-27
  • 2022-01-18
  • 2021-11-27
相关资源
相似解决方案