index.php里:
var request = new XMLHttpRequest();
request.open("POST","test.php");
request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var str="name="+url;
request.send(str);
text.php里:
$url=$_POST['name'];
echo $url;
两个文件在同一工程下,url是个变量,text.php执行会提示undefined index:name
readyState=4 Status=0 ,请问哪儿出错了
new XMLHttpRequest();
这个是在IE浏览器运行的么?只有IE支持这个对象,最好用jQyery的$ajax代替。
http://jun1986.iteye.com/blog/1399242
jQuery Ajax 实例 ($.ajax、$.post、$.get)
用get