ajax接收从php json数据为啥就是不显示呢
ajax接收从php json数据为什么就是不显示呢
php的代码
js的一段代码
------解决思路----------------------
document.getElementById("all_count_175040").innerHTML = list['175040Count'];
php的代码
<?php
$res2 = array('no1'=>'bsd', 'no2'=>'wuddy', 'no3'=>'xie');
echo json_encode($res2);
?>
js的一段代码
function oneLoadData()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
//document.getElementById("all_count_175040").innerHTML= "8888"
var ret = xmlHttp.responseText ;
alert (ret); //这里弹出 显示的正常。然后下面那个不弹出,html值也没有变
var list = eval("("+ret+")");
//var list = eval(ret);
alert(list[0].no1);
//document.getElementById("all_count_175040").innerHTML = list[0].175040Count;
document.getElementById("all_count_175040").innerHTML = list[0].no1;
}
}
------解决思路----------------------
document.getElementById("all_count_175040").innerHTML = list['175040Count'];