This is the code I am using to get the JSON response from PHP:
(function() {
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
$('#image-upload-form').ajaxForm({
dataType: null,
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
//console.log(percentVal, position, total);
},
complete: function(xhr) {
status.html(xhr.responseText);
var responseJSON = $.parseJSON(xhr.responseText);
//var responseJSON = eval('('+xhr.responseText+')');
/*var DOMElement = $(".progress-block-template").clone();
var pagename = typeof($("#pagename").attr('value')=='undefined')?'':$("#pagename").attr('value');
processingData(responseJSON,DOMElement,pagename);*/
}
});
})();
And here is the response getting while printing using .html()
.
{
"data": {
"thumb_location": "http://XXXX.com/private/U/367/catalog/3/16285/thumbs/220x220.jpg?Expires=1349242125&Key-Pair-Id=APKAIGM4K33RYJKUHOXA&Signature=ptphhyF2GL6xe7xeosrzfKkpsXm7fWQAapcF3rjsZMuTwSCMhj2SZDIKtKGZ35-OJjTJ1LXu7wGEQlQvdKrBqT2oiOcPtL7etgTzRLe4~ub3KF64HhkglKv4DgzAWfvG5v8rNfmFvSja3HQ4K8m2o3h0Tl1uv7Lbwpqq0p71L5M_",
"user_id": "367",
"category_id": "3",
"category_type": "worksample",
"asset_id": 16285,
"project_id": null,
"file_name": "Chrysanthemum_37726.jpg",
"size": 879394
},
"success": "true"
}
But if I do $.parseJSON
or eval
to parse the JSON response, it terminates the execution there itself. This is happening only in IE and it is working properly in FF and Chrome.