ajax 传输


 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>File Manage</title>
6 <script type="text/javascript" src="js/ajax.js"></script>
7 <script type="text/javascript">
8 function doRequest(){
9 window.httpObj.onreadystatechange = function(){
10 if(window.httpObj.readyState == 4 && window.httpObj.responseText){
11 //code to parse the response and update the page's content goes here
12 }
13 }
14 var url = 'process.php?param1=value+1 & param2=value+2 & nocache='+(new Date()).getTime();
15 window.httpObj.open('GET', url, true);
16 window.httpObj.send(null);
17 }
18
19 function doRequest(){
20 window.httpObj.onreadystatechange = function(){
21 if(window.httpObj.readyState == 4 && window,httpObj,responseText){
22 //code to parse the response and update the page's content goes here
23 }
24 }
25 var data = 'param1=value+1 & param2=value+2';
26 var url = 'process.php?cache=' + (new Date()).getTime();
27 window.httpObject.open('POST', url, true);
28 window.httpObj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
29 window.httpObj.setRequestHeader('Content-length', data.length);
30 window.httpObj.setRequestHeader('Connection', 'close');
31 window.httpObject.send(data);
32 }
33 </script>
34 </head>
35 <body>
36 </body>
37 </html>

 1 function createXMLHTTPObject(){
2 if(typeof XMLHttpRequest != 'undefined'){
3 return new XMLHttpRequest();
4 }else if(window.ActiveXObject ){
5 var axo = ['Microsoft.XmlHttp','MSXML2.XmlHttp','MSXML2.XmlHttp.3.0','MSXML2.XmlHttp.4.0','MSXML2.XmlHttp.5.0'];
6 for(var i = axo.length - 1; i > -1; i--){
7 try{
8 httpObj = new ActiveXObject(axo[i]);
9 return httpObj;
10 }catch(e){ }
11 }
12 }throw new Error('XMLHTTP not supported');
13 }

优质内容筛选与推荐>>
1、零基础学python-19.9 生成器函数与生成器表达式
2、javascript继承
3、C++编程思想(第1卷)pdf
4、重装系统后要做的事情
5、CodeIgniter2.0+ cli运行


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn