1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > ajax_post什么意思 求一个纯js 发起ajax post请求的例子 还有post请求

ajax_post什么意思 求一个纯js 发起ajax post请求的例子 还有post请求

时间:2024-05-14 04:47:12

相关推荐

ajax_post什么意思 求一个纯js 发起ajax    post请求的例子   还有post请求

求一个纯js 发起ajax post请求的例子 还有post请求的参数 有什么要注意的???

var xmlhttp;

function Button1_onclick() {

var name = encodeURI("北京西");

var dzb = "username=" + name + "&password=123";

send(dzb);

function send(arg) {

CreateXMLHttpRequest();

xmlhttp.onreadystatechange = callhandle;

//xmlhttp.open("GET","Default.aspx?goback=yes&arg=" + arg,true);

xmlhttp.open("POST", "http://172.16.5.25:9011/dynamicStation/loginByAdmin", true);

xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); //用POST的时候一定要有这句

xmlhttp.send(arg);

}

function CreateXMLHttpRequest() {

if (window.ActiveXObject) {

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

}

else if (window.XMLHttpRequest) {

xmlhttp = new XMLHttpRequest();

}

}

function callhandle() {

if (xmlhttp.readyState == 4) {

if (xmlhttp.status == 200) {

alert(xmlhttp.responseText);

}

}

}

}

ajax_post什么意思 求一个纯js 发起ajax post请求的例子 还有post请求的参数 有什么要注意的???...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。