eval内部:加上圆括号的目的是迫使eval函数在处理JavaScript代码的时候强制将括号内的表达式(expression)转化为对象,而不是作为语句(statement)来执行
2016-03-23
调用方法:document.getElementById("search").onclick=function(){
//TODO
}
//TODO
}
var request=new XMLHttpRequest();
request.open("GET","get.php",true);
request.send();
request.onreadystatechange=function(){ //监听的写法?
if(request.readyState==4&&request.status==200){
//sth..
request.responseXML;
}
}
request.open("GET","get.php",true);
request.send();
request.onreadystatechange=function(){ //监听的写法?
if(request.readyState==4&&request.status==200){
//sth..
request.responseXML;
}
}
2016-03-23
request.send("name=XXX&sex=male");//没有''
2016-03-23
request.open("GET","getInfo.php",true);//True没有引号
request.send();
//POST:
request.open("POST","post.php",true);
request.setRequestHeader("Content-type","application/x-www-form-unlencoded");
request.send();
request.send();
//POST:
request.open("POST","post.php",true);
request.setRequestHeader("Content-type","application/x-www-form-unlencoded");
request.send();
2016-03-23
var request;
if(windows.XMLHttpRequest){
request=new XMLHttpRequest();
}
else
{ request=new ActiveXObject("Microsoft.XMLHTTP");}
if(windows.XMLHttpRequest){
request=new XMLHttpRequest();
}
else
{ request=new ActiveXObject("Microsoft.XMLHTTP");}
2016-03-23