javascript - ajax出错,这是什么原因?
黄舟
黄舟 2017-04-10 18:03:17
0
7
441

这是后台给的数据:
{"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 "}

这个有错?

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

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

모든 응답(7)
PHPzhong

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

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

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

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

JSON语法有错误

阿神

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

黄舟

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

大家讲道理

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

左手右手慢动作

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

PHPzhong

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

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿