2013-11-20 45 views

回答

5

在JSON對象鍵需要用雙引號括起來。

試試這個:

jQuery.parseJSON('{"url":"/user-list.html"}'); 
+0

謝謝!這是解決方案!只要stackoverflow允許,我會盡快接受你的答案。 :-) –

1

JSON JavaScript不。基本上,{ url: '/user-list.html' }是無效的JSON。

spec指出「關鍵」部分必須是string,這需要雙引號。字符串值也需要雙引號,而不是單引號。