jquery - Parsing through a json list but only for one item in the list -


this works parse through in json object how can modify code give me 1 item in list? example, if wanted output item number two? reason asking: in project i'm re-doing jquery quiz , want output each question on separate page. therefore page 2 hold question 2, page 3 hold question 3 , on. much.

$(document).ready(function(){     var jsonp = '[{"language":"jquery","id":"1"},{"language":"c#","id":"2"}, {"language":"javascript","id":"3"} , {"language":"actionscript","id":"4"}]';     var lang = '';     var obj = $.parsejson(jsonp);     $.each(obj, function() {         lang += this['language'] + "<br/>";     });     $('span').html(lang); }); 

if want single language entry array, access array index:

var lang = obj[1].language; 

wokring example.


Comments