简体   繁体   中英

can't get data from json even getting a response on the console

I've been trying to send this information to the js.

$statement = ibase_prepare($sql);
    $query = ibase_execute($statement);

while ($row = ibase_fetch_assoc($query)) {
    $data[] = $row;
}
    echo json_encode($data);

However, when I try to, I get the response, but I can't get the data.

$('document').ready(function (){

 $.ajax({
    method: "POST",
    url: "../Dashboard/php/chart.php",
    dataType: "json",
    sucess: function (data){
   
      console.log(JSON.stringify(data));

    }
  });
})

You just have a grammatical error in a word "sucess", the correct word is "success"

  $.ajax({
      method: "POST",
      url: "./data.php",
      dataType: "json",
      sucess: function (data){ // Here -> success
        alert(JSON.stringify(data));

      }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM