jquery新手,求指教
var json = xml.responseText;
这一句取空了,请问是什么原因?
var contentDiv = "";
function createJson(){
var queryString = "city="+EncodeUtf8("01")+"&imei="+123;
return queryString;
}
function dataJson(xml,obj){
var json = xml.responseText;
alert(11111);
json = eval('(' + json + ')');
var jsonArr = json.contents;
alert(22222);
if(jsonArr!=null && jsonArr.length>0){
for(var i=0; i<jsonArr.length; i++){
contentDiv += "<tr style="height:20px;font-size:21px;cursor: pointer;width:100%;">"
+"<td rowspan=4 style="width:120px;padding-left:10px;"><img src=""+jsonArr[i].minimage+"" style="width:135px;height:110px;"/></td>"
+"<td style="width:340px;font-weight:800" title=""+jsonArr[i].contentName+""> "+jsonArr[i].name+"</td>"
+"<td rowspan=2 style="width:20px;"><img width="14" height="21" src="images/listcontent_arrow.png"/></td>"
+"</tr>"
+"<tr style="height:20px;font-size:21px;cursor: pointer;width:100%;">"
+"<td colspan=2 style="font-size:18px;"> 导演:"+(jsonArr[i].direct==""?"暂无":jsonArr[i].direct)+"</td>"
+"<td></td>"
+"</tr>"
+"<tr style="height:20px;font-size:21px;cursor: pointer;width:100%;">"
+"<td colspan=2 style="font-size:18px;"> 主演:"+(jsonArr[i].starring==""?"暂无":jsonArr[i].starring)+"</td>"
+"<td></td>"
+"</tr>"
+"<tr style="height:20px;font-size:21px;cursor: pointer;width:100%;">"
+"<td colspan=2 style="font-size:18px;"> 时长:"+(jsonArr[i].duration==""?"暂无":jsonArr[i].duration+"分钟")+"</td>"
+"<td></td>"
+"</tr>";
contentDiv += "</table><hr color="#cccccc"/>";
}
document.getElementById('contentDiv').innerHTML = contentDiv;
}else{
document.getElementById('contentDiv').innerHTML = '<p style="font-size:21px;"> 未查询到相关信息!</p>';
}
}
ajaxrequest(currentMovieList_url,"post",true,createJson(),dataJson,this); jQuery
[解决办法]
先看看xml是什么,有可能是xml.responseXML;