为了账号安全,请及时绑定邮箱和手机立即绑定

ajax获取json后无法解析出数据,为什么呢?

ajax获取json后无法解析出数据,为什么呢?

慕尼黑的夜晚无繁华 2019-03-20 14:13:35
html代码<body><span id="show_check"></span><br /> <span id="show_flag"></span><br /><script>var xmlhttp;if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safarixmlhttp=new XMLHttpRequest();}else{// code for IE6, IE5xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlhttp.onreadystatechange=function(){if (xmlhttp.readyState==4 && xmlhttp.status==200){document.getElementById("show_check").innerHTML=xmlhttp.responseText;var ajax=xmlhttp.responseText;alert(ajax[0].no1)}}xmlhttp.open("GET","22.php",true);xmlhttp.send();</script></body>---------------------------------------------------------------------------------------22.php代码<?php $info = array(array('no1'=>'bsd', 'no2'=>'wuddy', 'no3'=>'xie')); $userinfo = json_encode($info); echo $userinfo; ?>alert不出来json数据怎么回事呢
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 1234 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信