vendredi 25 avril 2014

Patse JSON Array Item With No Name Using jQuery


Vote count:

0




I'm trying to figure out how to use JSON feeds and display them on PHP pages. I've learned a lot using various examples but I've run into a snag with a specific situation. Dealing with arrays that don't have specific names or IDs for each field.


For instance:



{
"Team1": [
"2869",
"4039817.99"
],
"Team2": [
"66",
"113980.00"
],
"Team3": [
"3408",
"4671603.22"
]
}


Now, I only want to retrieve the second number in each of those arrays, but I can't for the life of me figure it out.


I've tried using this script to display it in a table but every iteration of this I try, it doesn't seem to work:



<script>
var dmJSON = "http://...";
var completeurl = dmJSON;

$.getJSON( completeurl, function(data) {
$.each(data.objects, function(i, f) {
var tblRow = "<tr>" + "<td>Team 1</td>" + "<td>" + f.Team1.1 + "</td>" + </tr>"
$(tblRow).appendTo("#entrydata tbody");
});

});
</script>


Any suggestions?



asked 21 secs ago






Aucun commentaire:

Enregistrer un commentaire