这行代码出了什么问题?(jQuery.parseJSON)
What is wrong with this line of code? (jQuery.parseJSON)
这行jQuery代码出了什么问题?
jQuery.parseJSON("{ url: '/user-list.html' }");
我总是得到以下错误:
SyntaxError: Unexpected token u
试试这个:
jQuery.parseJSON('{"url":"/user-list.html"}');
JSON不是JavaScript。基本上,{ url: '/user-list.html' }
是无效的JSON。
规范规定"key"部分必须是string
,这需要双引号。字符串值还需要双引号,而不是单引号。
相关文章:
- 为什么我不能使用jQuery.parseJSON(json)解析json字符串
- 如何使用jQuery.parseJSON绕过换行符
- jQuery.parseJSON()未在Windows服务器上解码有效的Json字符串
- 这行代码出了什么问题?(jQuery.parseJSON)
- jQuery.parseJSON 不适用于 Ajax Success
- “意外的令牌{”当使用jquery.parsejson()
- jQuery.parseJSON u0092 字符未解析
- jQuery.parseJSON 无法解析序列化的 C# 字典
- jQuery.parseJSON 不附加任何值
- Jquery.parseJSON 在 Firefox 3.6 上的兼容性
- jQuery.ParseJSON 变量问题
- jQuery.parseJSON 中的语法错误
- jQuery.parseJSON 不适用于给定的字符串
- 如何使用jQuery.parseJSON获取数据
- 使用jQuery.parseJSON检索包含空白的php数组
- jQuery.parseJSON给出错误意外标记
- 为什么'jQuery.parseJSON'没有必要
- JSON Parse JSON和Jquery ParseJson在visualforce中不起作用
- jQuery.ParseJSON返回一个字符串
- 有效的JSON不能与jQuery.parseJSON()一起工作