Home >Backend Development >PHP Tutorial >javascript - PHP相应JS请求会把相应显示在页面的问题

javascript - PHP相应JS请求会把相应显示在页面的问题

WBOY
WBOYOriginal
2016-06-06 20:50:12965browse

php响应js请求的数据会在页面上显示出来,如图所示: PHP相应的语句是die($repArr); $repArr = array( 'rateValue' => $usrRate, 'rateScore' => $score, ); javascript - PHP相应JS请求会把相应显示在页面的问题

回复内容:

php响应js请求的数据会在页面上显示出来,如图所示: PHP相应的语句是die($repArr); $repArr = array( 'rateValue' => $usrRate, 'rateScore' => $score, ); javascript - PHP相应JS请求会把相应显示在页面的问题

看楼主图片,是json_encode过的吧,那么php输出的时候应该header声明返回类型是json, 或者使用jquery的.ajax的时候指定dataType为json

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn