Hello stackoverflow community, I need help with ajax $.get
function. When I recieve array from getlist.php and i alert ir like this alert(data_list);
everything works correctly. But when I try to alert like this alert(data_list.id)
it doesn't work. Here is how my array looks like in console:
[{"id":"2","name":"Something","type":"horizontal","clicks":"0","start_date":"01/20/2016","end_date" :"02/19/2016","status":"1","target":"http://","image_url":"http://","pre_exp_email":"0"},{"id" :"1","name":"None","type":"horizontal","clicks":"2","start_date":"01/20/2016","end_date":"05/19/2016" ,"status":"1","target":"http://wps.us.lt","image_url":"http://....../wp-content/uploads/2016 /01/250by250ad.jpg","pre_exp_email":"0","group_id":["1"],"slots":{"1":"1"}}]
And here is myfunction which calls get function.
function get_list() {
jQuery.get("/wp-content/plugins/wp125/functions/getlist.php", { grouptype:jQuery('#grouptype').val() }, function(data_list){
var str;
alert(data_list.name);
});
}