ajax.js

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
    }
}

 

posted @ 2015-11-10 17:36  Cynthia娆墨旧染  阅读(125)  评论(0编辑  收藏  举报