jQuery - Parsing JSON file based on mouse click -
this more of theory question rather specific programming problem.
what i'm trying create world of tanks player "search engine" following steps:
- enter username of player
- parse json object of players similar names , append page
- based on name user clicks, clear page , populate json object specific player.
i can generate url returns json file of player, i'm having trouble figuring out way render information page.
here's jsfiddle of code.
this function creates list of matching players , turns name link json file.
$.getjson(searchurl, function(data){ $.each(data, function(key, value){ if(typeof value === 'object'){ for(var i=0; < data.count; i++){ var fullplayerurl = "<p class='entry'>" + "<a>" + key + "nickname - " + value + "</a>" + "</p>"; $('#results').append(fullplayerurl); } } }); }); //end getjson
my question is, best way generate player's data based on name user clicks (instead of following link json file)?
thanks!
Comments
Post a Comment