responseXML返回一个空值

今天在联系Ajax的联系时,通过XMLHttpRequest对象的时候,返回里面的XMLHttpRequest的属性responseXML是空值,仔细查看代码

 

代码
CreteXmlhttp();
var url = "http://localhost:4496/SumIt.asmx";
var queryString = creatQueryString();
xmlHttp.open(
"POST",url,true)
xmlHttp.onreadystatechange
= handleStateChange;
xmlHttp.setRequestHeader(
"Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(queryString);

 

 

 

发现时在url变量赋值错误

正确的代码应该为:

 

代码
CreteXmlhttp();
var url = "http://localhost:4496/SumIt.asmx/Sum";
var queryString = creatQueryString();
xmlHttp.open(
"POST",url,true)
xmlHttp.onreadystatechange
= handleStateChange;
xmlHttp.setRequestHeader(
"Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(queryString);

 

应该把回调的函数直接写完整,下次一定要认真仔细,害我浪费一个小时。

posted @ 2010-06-10 12:52  寒潭  阅读(911)  评论(0编辑  收藏  举报