views:

190

answers:

1

Hi,

Is there any way to make multiple requests to the callback function in asp.net when using the ICallbackEventHandler? I need the results for each result, however, when I iterate through and call the function, I get the result only for the last call. Any way to make it return a result for each call?

This is what I am passing in via javascript:

    function NoPostback() {
        $(".spans").each(function(index, item) {
            CallServer($(item).attr("myattr"));
        });
    }

In this, myattr is a custom attribute that holds a value (1..10). What I want returned is something like ('you said: ' + id) to be returned for each of the calls, so that I can go ahead and place them in the appropriate holders.

However, only one item is returned which is the final call made. For instance if there are 4 items, it returns only ('you said: 4').

Any idea on how to have all of them returned?

Thanks in advance.

+1  A: 

Most Javascript AJAX frameworks either abort any subsequent requests if one is in progress, or they ignore previous requests and only handle the latest. The AJAX request itself will pass through the browser's XmlHttpRequest object, but the rest of the javascript code is running within the pages thread. Currently, there is no concurrent programming with javascript (however this is slated to change.)

jrista