$.ajax and JSON Response
$.ajax and JSON Response
Hi,
I'm having a tough time getting at the values I want in this ajax response.
Here is the response
{"COLUMNS":["SITE_ID","PARENT_ID","DISPLAY_NAME"],"DATA":[[87,19,"The Site Name"],[2,19,"Another Site Name"]]}
success: function(resp){
alert( resp.DATA.length ); // this works, shows me the right number
var options = '';
for (var i = 0; i < resp.DATA.length; i++) {
options += '<option value="' + resp.DATA[i].SITE_ID + '">' + resp.DATA[i].DISPLAY_NAME + '</option>';
}
}
I'm trying to get the value of the "site_id" and the "display_name" column but I can't get it right.
Anyone see anything wrong??
Thanks,
-ws