search

Home  >  Q&A  >  body text

javascript - ajax出错,这是什么原因?

这是后台给的数据:
{"errcode":0,"data":"Domain Name: 7839.com
Registry Domain ID: 103563797_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.ename.com
Registrar URL: http://www.ename.net
Updated Date: 2016-08-15T22:03:07Z
Creation Date: 2003-09-15T01:27:01Z
Registrar Registration Expiration Date: 2017-09-15T01:27:01Z
Registrar: eName Technology Co.,Ltd.
Registrar IANA ID: 1331
Registrar Abuse Contact Email: abuse@ename.com
Registrar Abuse Contact Phone: +86.4000044400
Domain Status: clientDeleteProhibited https://www.icann.org/epp#clientDeleteProhibited
Domain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited
Registry Registrant ID:Not Available From Registry
Registrant Name: Xiamen PrivacyProtection Service Co. Ltd.
Registrant Organization: Xiamen Privacy Protection Service Co. Ltd.
Registrant Street: Software Park wanghai Road No. 19, 603
Registrant City: Xiamenshi
Registrant State/Province: Fujian
Registrant Postal Code: 361000
Registrant Country: CN
Registrant Phone: +86.5922669759
Registrant Phone Ext:
Registrant Fax: +86.5922669760
Registrant Fax Ext:
Registrant Email: 1nvywn68o@enamewhois.com
Registry Admin ID:Not Available From Registry
Admin Name: Xiamen PrivacyProtection Service Co. Ltd.
Admin Organization: Xiamen Privacy Protection Service Co. Ltd.
Admin Street: Software Park wanghai Road No. 19, 603
Admin City: Xiamenshi
Admin State/Province: Fujian
Admin Postal Code: 361000
Admin Country: CN
Admin Phone: +86.5922669759
Admin Phone Ext:
Admin Fax: +86.5922669760
Admin Fax Ext:
Admin Email: 1nvywn68o@enamewhois.com
Registry Tech ID:Not Available From Registry
Tech Name: Xiamen PrivacyProtection Service Co. Ltd.
Tech Organization: Xiamen Privacy Protection Service Co. Ltd.
Tech Street: Software Park wanghai Road No. 19, 603
Tech City: Xiamenshi
Tech State/Province: Fujian
Tech Postal Code: 361000
Tech Country: CN
Tech Phone: +86.5922669759
Tech Phone Ext:
Tech Fax: +86.5922669760
Tech Fax Ext:
Tech Email: 1nvywn68o@enamewhois.com
Name Server:
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2016-11-13T16:24:51Z "}

这个有错?

我直接取数据库数据模拟了下,没问题啊:

黄舟黄舟2774 days ago439

reply all(7)I'll reply

  • PHPz

    PHPz2017-04-10 18:05:17

    未捕获的语法错误:在JSON串0出出现了意外的符号 ‘D’

    JSON格式错了,检查下返回的JSON串格式

    应该是换行符的原因,
    你们在data字段中存放了多个字段的数据,
    建议将data字段进行分割
    比如

    {
    "errcode":0,
    "data":{
        "DomainName" :"xxx",
        "DomainID" :"xxx"
        }
    }

    reply
    0
  • 怪我咯

    怪我咯2017-04-10 18:05:17

    JSON语法有错误

    reply
    0
  • 阿神

    阿神2017-04-10 18:05:17

    这个可能是后台返回的数据格式出错,解析出错了,猜想是没有找到json格式的标识,也就是大括号。

    reply
    0
  • 黄舟

    黄舟2017-04-10 18:05:17

    json里的字符串(双引号之间的字符串)发生了换行了吧,请把“\n”换成“\\n”。

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-10 18:05:17

    如 @dollor 的回答,后端返回的json数据中包含换行符,在解析的时候就会异常截断运行代码,导致语法报错

    reply
    0
  • ringa_lee

    ringa_lee2017-04-10 18:05:17

    谢邀。看了楼上他们的回答。应该你已经可以解决问题了

    reply
    0
  • PHPz

    PHPz2017-04-10 18:05:17

    谢邀,来晚了,已经解决了。

    reply
    0
  • Cancelreply