All,
I’ve got a function that basically gets triggered when an Upload finishes. I have the following code in that function:
onFinish: function (e, data) {
console.log(data.result);
},
When I do this I get the following response in my console:
[{
"name": "1_3266_671641333369_14800358_42187036_5237378_n.jpg",
"size": 35535,
"type": "image\/jpeg",
"url": "\/web\/upload\/1_3266_671641333369_14800358_42187036_5237378_n.jpg",
"thumbnail_url": "\/web\/upload\/thumbnails\/1_3266_671641333369_14800358_42187036_5237378_n.jpg",
"delete_url": "\/web\/upload.php?file=1_3266_671641333369_14800358_42187036_5237378_n.jpg",
"delete_type": "DELETE",
"upload_type": "video_montage"
}]
I’d like to get the value that is in the upload_type and do some actions based on that but I’m not sure how to get this from my function. Any help would be appreciated to get this information.
Thanks!
data.resultis an array, you need to access the first element and then accessupload_type.Try
console.log(data.result[0].upload_type);Update:
If data.result is a string, you need to parse it first.Try