How to JSON decode array elements in JavaScript?

前端 未结 7 733
盖世英雄少女心
盖世英雄少女心 2020-11-30 08:40

I have a JavaScript array that, among others, contains a URL. If I try to simply put the URL in the page (the array is in a project involving the Yahoo! Maps API) it shows t

7条回答
  •  情书的邮戳
    2020-11-30 09:33

    var obj = jQuery.parseJSON('{"name":"John"}');
    alert( obj.name === "John" );
    

    See the jQuery API.

提交回复
热议问题