Ajax: The value returned in the background echoes to the page, but the front end does not take these values!

Source: Internet
Author: User

This is the header information sent.

This is the response data

This is the data printed on the background page.

The last code to post in the background:

if($_POST['idp']){           //如果地址栏中有idp,则通过idp获取产品信息;否则根据当前时间获取(取最近有的数据)    $idp = $_POST['idp'];    $sql = "SELECT * FROM `product` WHERE id={$idp}";}else{                       //如果没有idp ,则获取最近期的产品信息    $sql = "SELECT * FROM `product` ORDER BY time DESC LIMIT 1"; }//定义常量$result = array();            $commentData = array();//读取产品的详细信息$productRes = mysql_query($sql, $connect);$productData = mysql_fetch_array($productRes, MYSQL_ASSOC);  //产品详情和相应评论的结果集array_push($result, $productData, $commentData);//array_shift($result);echo json_encode($result);?>

Reply content:

This is the header information sent.

This is the response data

This is the data printed on the background page.

The last code to post in the background:

if($_POST['idp']){           //如果地址栏中有idp,则通过idp获取产品信息;否则根据当前时间获取(取最近有的数据)    $idp = $_POST['idp'];    $sql = "SELECT * FROM `product` WHERE id={$idp}";}else{                       //如果没有idp ,则获取最近期的产品信息    $sql = "SELECT * FROM `product` ORDER BY time DESC LIMIT 1"; }//定义常量$result = array();            $commentData = array();//读取产品的详细信息$productRes = mysql_query($sql, $connect);$productData = mysql_fetch_array($productRes, MYSQL_ASSOC);  //产品详情和相应评论的结果集array_push($result, $productData, $commentData);//array_shift($result);echo json_encode($result);?>

The JSON returned by accessing roamguid.sinaapp.com/page/detail/getdetail.php is GET , executing the $sql = "SELECT * FROM product ORDER BY time DESC LIMIT 1";
And you post preach it idp false ?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.