简体   繁体   English

即使在控制台上也无法从 json 获取数据

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

I've been trying to send this information to the js.我一直在尝试将此信息发送给 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));

      }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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