I used JSON.stringify but it returns undefined. Ajax call returns an array of objects e.g. {“FileName”: “example1.jpg”, “StatusCode”: 200, “StatusMessage”: “Succesfull”}, {“FileName”: “example2.jpg”, “StatusCode”: 200, “StatusMessage”: “Succesfull” }. How can I access to StatusMessage from the objects?
$.ajax({
url: my.webserviceUploadImageUrl,
type: 'POST',
enctype: 'multipart/form-data',
processData: false,
contentType: false,
cache: false,
data: formData,
success: function (result) {
var statusmessage = JSON.stringify(result[i]["StatusMessage"]);
var url = location.protocol + '//' + location.host + location.pathname;
if (url.indexOf('?') > -1) {
url += '&message=' + statusmessage;
} else {
url += '?message=' + statusmessage;
}
window.location.href = url;
},
error: function () {
self.statusMessage("Error uploading images. Please refresh the page and try again");
}
});