0

I have a jquery code where i do this :

            var resuSave = "";
            $(".attachFile").each(function()
            {
               $.ajax({
                  url: monurl.php
                  type: 'POST',
                  data: myData,
                  type: 'POST',
                  success: function(data)
                  {
                     resuSave = resuSave.concat(data);
                  }
               });
            });
            alert(resuSave);

But my variable resuSave still alert an empty string. So i try to initialize resuSave at "toto" and do an alert of it in the success of my ajax request and their is "toto" in my alert. I also do an alert(data) and it's print me some text. So i don't understand why this code don't want to put some text in my variable resuSave.

khollenbeck
  • 16,028
  • 18
  • 66
  • 101
Kvasir
  • 1,197
  • 4
  • 17
  • 31
  • Have you try resuSave += data and in ajax call type: 'POST' is defined two times – 111 Apr 03 '15 at 10:22
  • Thank you you right i didn't see for the type. But yea i try and it don't work too – Kvasir Apr 03 '15 at 10:26
  • But it's work if i do like it's explain here :http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous-call – Kvasir Apr 03 '15 at 10:32

0 Answers0