ajax原生代码
var oAjax = null;
if(window.XMLHttpRequest){
oAjax = new XMLHttpRequest();
}else{
oAjax = new ActiveXObject("Microsoft.XMLHTTP");
}
oAjax.open('POST', "/index.php/Wap/Index/wawaopen", true);
oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
oAjax.send("zhongjiangcode="+zhongjiangcode+"&chang="+chang+"&hbid="+hbid);
oAjax.onreadystatechange = function(){
if(oAjax.readyState == 4){
if(oAjax.status == 200){
var data1 = oAjax.responseText;
var data = eval("("+data1+")");
}
}
};
jquery封装的ajax请求
$.ajax({
url: '/wap/login/register',
data: idata,
type: 'POST',
dataType: "json",
error: function (ret, error) {
},
success: function (res) {
}
});