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

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

WBOY
WBOYOriginal
2016-06-06 20:10:25977browse

用jquery的get()

回复内容:

用jquery的get()

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

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

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

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