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
refer this answer, i have done like this
javascript :
$('#input-id').on('fileuploaded', function(event, data, previewId, index) {
var form = data.form, files = data.files, extra = data.extra,
response = data.response, reader = data.reader;
console.log('File uploaded successfully : ID '+ data.response.d);
});
In ASHX File add response to the context:
context.Response.ContentType = "application/json";
string myId = "NewwId 1";
var wrapper = new { d = myId };
context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(wrapper));