asynchronous - Sequential Ajax Calls fail in ASP.NET MVC -


I have seen many solutions to this problem but nothing is doing to fix my problem.

I

  1. Use AJAX calls on the page to upload the file.
  2. Ajax calls AJAX calls to refresh the page to include the uploaded file after the Ajax call is over in the same function.

    I use it as the first call (to upload) another stack overflow user):

      function upload files () {document. GetElementById ('fileupload'). Onsubmit = function () {var formdata = new formData (); // FormData object var fileinput = document.getElementById ('upload filename'); // Selected file input through each file (i = 0; i   

    reloadman () is the function:

      function reloadman () {$ .ajax ({url: '/ dashboard} / Thumb list / current path type: "received", timeout: 5000, success: function (msg) {$ ("# thumb-list"). Html (msg)}, error: display error (" Disabled listing ")});}   

    I have seen it:

    1. Uploaded in 'Refresh' IEL information is not included in the response
    2. IE11 and Chrome work differently.
    3. It seems that the problem is that the controller / system file operation is not completed quickly (I used the "Disapproved Login ... Usage File" error while using Chrome.

      So, it seems that AJAX has to wait to refresh Unless the file system functions It does not complete.

      Would you agree? If so, how can I do this job?

      You can either set your XMLHttpRequest async incorrectly:

       < code> xhr.open ('post', '/ dashboard / upload file', incorrect);   

      Or you can call your recent event in the callback:

        var xhr = New XMLHttpRequest (); Xhr.open ('POST', '/ dashboard / upload file'); Xhr.send (formdata); xhr.onreadystatechange = function () {if (xhr.readyState == 4 & amp;; & xhr.status == 200} {reloadMain (); // only referee ASH file post gets 200 responses}}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -