doedje / jquery.soap

This script uses $.ajax to send a SOAP:Envelope. It can take XML DOM, XML string or JSON as input and the response can be returned as either XML DOM, XML string or JSON too.
352 stars 147 forks source link

SOAP Requests in a for loop don't appear to be sending #48

Closed deadly-platypus closed 10 years ago

deadly-platypus commented 10 years ago

I am writing a function that gets a list of IDs to query my application server for information. Once I have the list, I send a SOAP request to the same method but with different data using a for loop:

for(var i = 0; i < ids.length; i++)
{
         $.soap({
        method: 'getGroupInfo',
        data: {
                arg0: ids[i]
            },
        elementName: 'tns:getGroupInfo',
        success: function (soapResponse) {
                        // Do stuff
                }
        });
}

If I use the javascript debugger and step through the code, the request is sent, however, if I don't slow down the system, then Firefox shows no request sent to my server after the first request to get the ID list.

doedje commented 10 years ago

I tested this in my testbed and I had no problems with $.soap from within a for loop. Are you sure the call you are making is okay? The code above is missing an url for instance....

doedje commented 10 years ago

You might try removing the for loop for a sec and set one of the id's manually and see if that call does work....

zachofalltrades commented 10 years ago

Derrick - you indicate that the first request IS sent, but none after that. Without more to go on, I don't think there is much we can look for in the soap plugin. I would suggest that you do a couple of things to be sure that for loop is behaving as expected, without regard to the soap call. First, before entering the loop log or display the value of 'ids.length'; second, just inside the loop, but before calling the soap plugin, log or or display the value of 'i'.

On Wed, May 7, 2014 at 3:58 AM, Remy Blom notifications@github.com wrote:

You might try removing the for loop for a sec and set one of the id's manually and see if that call does work....

— Reply to this email directly or view it on GitHubhttps://github.com/doedje/jquery.soap/issues/48#issuecomment-42403994 .

doedje commented 10 years ago

I'll close this issue....