How to parse JSONP data returned from remote server

前端 未结 2 1512
野趣味
野趣味 2020-12-14 02:38

I am trying to grab some data via JSONP. Using Firebug, I am able to see the data properly being returned, but I am having a hard time thinking how I have to parse it. The d

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 03:02

    You don't have to parse the data. It is already a valid JavaScript object. For instance, to print the description property for the first object inside someFunction

    function someFunction(result) {
        alert(result[0].description); // alerts "Sample Description"
    }
    

提交回复
热议问题