【发布时间】:2015-09-02 03:03:00
【问题描述】:
我已成功使用PDO 从我的数据库中获取数据,使用PDO::FETCH_OBJ 方法,查询返回如下:
Array (
[0] => stdClass Object
(
[id] => 2
[title] => Johnny Sims
[img] =>
[description] =>
[school] =>
[location] => 1
[url] =>
[tablename] => 2
[votes] => 5
[name] => President Candidates
[Numopinions] => 6
)
[1] => stdClass Object
(
[id] => 2
[title] => Jeremy Pinto
[img] =>
[description] =>
[school] =>
[location] => 1
[url] =>
[tablename] => 2
[votes] => 4
[name] => Presidential Candidates
[Numopinions] => 6
)
[2] => stdClass Object
(
[id] => 2
[title] => Sarah Bushels
[img] =>
[description] =>
[school] =>
[location] => 1
[url] =>
[tablename] => 2
[votes] => 3
[name] => Presidential Candidates
[Numopinions] => 6
)
)
如果这是回显的内容,人们将如何使用 AJAX GET 请求与此数据进行交互?
【问题讨论】:
-
您可以像在没有
AJAX的情况下访问它一样访问它。什么意思? -
唯一认为您可能需要做不同的是
echo使用jSON编码。