Home > Backend Development > PHP Tutorial > jquery - 怎么在一个php文件返回两条查询结果的json数据?

jquery - 怎么在一个php文件返回两条查询结果的json数据?

WBOY
Release: 2016-06-06 20:10:25
Original
1041 people have browsed it

用jquery的get()

回复内容:

用jquery的get()

<code class="js">var response = {
  data: {
    data1:1,
    data2:2
  },
  status: 0,
  msg: 'success'
}</code>
Copy after login

php 返回大概如上述格式的数据就行。
使用的时候 data.data1 data.data2

将两条查询结果push到一个新的变量中,然后return json_encode(新的变量);

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template