I\'m using Krajee the Bootstrap File Input plugin to perform an upload via AJAX call.
Here is the link to the Krajee plugin AJAX section: Krajee plugin AJAX
The
you can use this sample code in your test.in my test,my response data like this:
response data:
{
"ver":"1.0",
"ret":true,
"errmsg":null,
"errcode":0,
"data":{
"status":"upload success",
"originalFilename":"testFileName.txt",
"fileName":"excelFile",
"fileType":"text/plain",
"fileSize":1733
}
javascript code:
$('#input-id').on('fileuploaded', function(event, data, previewId, index) {
var response = data.response;
if(response.ret ) {
alert("upload success!"+data.response.data);
}else{
alert("upload failed!"+response.errmsg)
}
alert('File uploaded triggered'+form+"response:"+response);
console.info(response.data);
});