码迷,mamicode.com
首页 > Web开发 > 详细

ajax.js

时间:2015-11-10 18:57:38      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

var request = new XMLHttpRequest()

if(window.XMLHttpRequest){
    request = new XMLHttpRequest()
}else{
    request = new ActiveXObject("Microsoft.XMLHTTP")
}

request.open(‘POST‘,‘create.php‘,true)
request.setRequestHeader(‘Content-type‘,‘application/x-www-from-urlencoded‘)
request.send(‘name=王二狗&sex=女‘)

request.onreadystatechange = function(){
    if(request.readyState === 4 && request.status ===200){
        // do sth
    }
}

 

ajax.js

标签:

原文地址:http://www.cnblogs.com/cynthia-wuqian/p/4953774.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!