Mih*_*nca 2 php ajax jquery json return
我一直$.getJSON在使用exit("{'status':true}")(或false)来验证脚本是否正确完成了工作,但是现在我需要脚本来返回值(或数组)。我知道我不能使用 exit('{ "status": $myarray}');。我该怎么用呢?我是php的新手,有可能做类似的return '{ "status": $myarray}';事情吗?提前致谢
$.getJSON
exit("{'status':true}")
exit('{ "status": $myarray}');
return '{ "status": $myarray}';
Rij*_*ael 5
您可以使用以下功能:
json_encode($data);
请参阅:http: //php.net/manual/en/function.json-encode.php
归档时间:
12 年,11 月 前
查看次数:
4243 次
最近记录: