Krajee Bootstrap File Input, catching AJAX success response

前端 未结 5 2079
无人共我
无人共我 2021-02-08 04:21

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

5条回答
  •  野性不改
    2021-02-08 04:41

    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));
    

提交回复
热议问题