【问题标题】:How to Display ajax responseText? [duplicate]如何显示ajax responseText? [复制]
【发布时间】:2016-06-26 17:31:49
【问题描述】:

嗨朋友们,我如何才能得到这里的主要信息是展示我的 j44?

error: function (xhr, status, errorThrown) {
alert(xhr.responseText);
}

【问题讨论】:

  • xhr.responseText.category[0]
  • @Niklesh — 这将引发异常。 xhr.responseText.categoryundefined,您无法访问[0]undefined
  • 你找到解决方案了吗?

标签: javascript jquery ajax xmlhttprequest


【解决方案1】:

做起来

error: function (xhr, status, errorThrown) {
   alert(JSON.parse(xhr.responseText).category[0]);
}

【讨论】:

  • 这将引发异常。 xhr.responseText.categoryundefined,您无法访问[0]undefined
猜你喜欢
  • 2023-03-19
  • 1970-01-01
  • 2020-04-30
  • 1970-01-01
  • 2020-04-18
  • 1970-01-01
  • 2011-06-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多