var namestring="<aa><bb>123</bb></aa>"
xmlHttp.open("POST", url);
xmlHttp.onreadystatechange = callback;
xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlHttp.send(namestring);
可以传递字符串但是必须为xml格式,通过服务器端接受
xmlHttp.open("POST", url);
xmlHttp.onreadystatechange = callback;
xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlHttp.send(namestring);
可以传递字符串但是必须为xml格式,通过服务器端接受
xmlHttp.open()后不就接受了么?
我不要send(null)都可以运行呢?假如send(x)中的x不为空,服务器端接受什么?怎么接受?PHP怎么接受怎么处理这个x?
var SendData = 'regid='+aa+'®password='+bb
X.send(SendData)
可以这样传递
X.send(SendData)
就有用场了
从web表单获取数据后到js里
1 创建XMLHttpRequest对象
2 然后用这个对象操作open()方法 即 XMLHttpRequest.open("post",url,true);
3 用这个对象操作onreadystatechange这个属性
即XMLHttpRequest.onreadystatechange=callback; //指定响应函数
4 用这个对象操作send()方法 即 XMLHttpRequest.send(null);现在我想问下 2 3 4这个顺序可以随便写么,就是先XMLHttpRequest.onreadystatechange=callback; //指定响应函数
在
XMLHttpRequest.open("post",url,true);
另外我很奇怪,为什么没send()就先执行返回相应函数了??就是
先 XMLHttpRequest.onreadystatechange=callback; //指定响应函数
然后再 XMLHttpRequest.send(null);
都没发送,怎么获取返回的数据呢?
麻烦大家帮帮忙解释下!越详细越好!