Ajax post request with xhr stopping all author requests

时间:2018-02-03 07:38:07

标签: javascript jquery .net ajax amazon-s3

my requirement is upload files to server. i using ajax call. when this ajax call starts remain all retests will goes on pending.

my code is:

function AddVideos(row, Video, CoverPhoto) {
    var param = { "ObjectFile": Video, "CoverPhoto": CoverPhoto, "VideoID": $(row).find('span.VidoID').text() };
    var Data = new FormData();
    $.each(param, function (key, element) {
        Data.append(key, element);
    });
    $.ajax({
        type: 'POST',
        url: '/KnowledgeAreas/AddVideos',
        data: Data,
        context: row,
        xhr: function () {
            var myXhr = $.ajaxSettings.xhr();
            if (myXhr.upload) {
                myXhr.upload.addEventListener('progress', function (event) { progress(event, row) }, false);
            }
            return myXhr;
        },
        async: true,
        cache: false,
        contentType: false,
        processData: false,
        success: function (data) {
            GetVideos();
            $('#tblUploadingVideos tbody').find('span[name=' + $(row).find('span.VidoID').text() + ']').parents('tr').remove();
            if ($('#tblUploadingVideos tbody tr').length == 0) {
                $('#tblUploadingVideos').hide();
            }
        },
        error: function (data) {
        }
    });
};

while processing this request. remain all requests will stop in queue.

you can see below .

enter image description here

1 个答案:

答案 0 :(得分:1)

我已通过更新会话状态解决了此问题:

[SessionState(SessionStateBehavior.ReadOnly)]