未捕获的TypeError:无法读取未定义的属性“成功”

时间:2019-03-24 22:52:00

标签: jquery html properties uncaught-typeerror

因此,我的代码的if / else塑像部分出现错误,该错误返回错误:Uncaught TypeError:无法读取未定义的属性'success'。有任何想法吗?

function responseReceivedHandler(data) {
/* Successful request:
  {
     "success": true,
     "todos": [ '...', '...', ... ]
  }

  Unsuccessful request:
  {
     "success": false,
     "error": "..."
  } */

/* Your solution goes here */
if (this.response.success === true)
{
console.log(this.response.todos);
}
else {
console.log(this.response.error);
}
}

$.get("https://wp.zybooks.com/todos.php", { day: "Monday" }, 
responseReceivedHandler, "json");

0 个答案:

没有答案