Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
146
rated 0 times [  153] [ 7]  / answers: 1 / hits: 26822  / 14 Years ago, sun, august 22, 2010, 12:00:00

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 data return is really a nested array correct? someFunction is the name of the callback function. This is how the data looks:



someFunction([  
{
title:Sample Title,
link:http://example.com,
description:Sample Description,
publisher:Sample Publisher,
creator:Sample Author,
date:Thu, 19 Aug 2010 12:41:29 GMT,
num_pages:10,
num_results:10
},
]);


Just a little confused about how to properly parse and output.


More From » jquery

 Answers
5

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
}

[#95850] Wednesday, August 18, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
feliciarainak

Total Points: 104
Total Questions: 91
Total Answers: 83

Location: Greenland
Member since Thu, Oct 27, 2022
2 Years ago
;