且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery AJAX调用数据库查询

更新时间:2022-06-04 06:50:21

您的ajax成功将返回的数据视为html,但它是json.

Your ajax success is treating the returned data as html but it is json.

var allresult = result.res
 /* assumes allResult is html and can be inserted in DOM*/
 $('#result').html(  allresult  );

您需要解析json以创建html,或从服务器返回html

You need to parse the json to create the html, or return html from server

也是php循环:

$name = $rowss['display_name']; 

应该更像是:

$name[] = $rowss['display_name'];