Results 1 to 6 of 6

Thread: Interference with two AJAX requests

  1. #1

    Default Interference with two AJAX requests

    Hi there,

    I have two AJAX-requests, and both of them are delivering the correct response if I open the URLs directly. But if I call those two URLs in the mentioned two separate requests, both of them are receiving the response from the first request. Here's my code:

    Code:
    function retriveNewCategory( checkBoxId )
    {
    retrieveFilteredIdeas( baseUrl + checkBoxId );
    retrieveFilteredCustomers( checkBoxId );
    }
    
    function retrieveFilteredIdeas( fromUrl )
    {
    var ajaxRequestIdeas = Ext.Ajax.request
    ({
    url: fromUrl,
    disableCaching: false,
    success: handleFilteredIdeas,        
    failure: function(){}
    });
    }
    
    function retrieveFilteredCustomers( categoryId )
    {
    var ajaxRequestCustomer = Ext.Ajax.request
    ({
    url: 'index.php?/' + language + '/shared/ajax/filteredCustomers/' + categoryId,
    disableCaching: false,
    success: handleFilteredCustomers,        
    failure: function(){}
    });
    }
    I don't get it, because I even assign those two requests to separate variables, but they do interfere anyway... is there some sort of unique ID I could assign to both of them or something? I do not want to make the application wait for one of those requests before starting the next, as that would not be in the sense of *asynchronous* Javascript^^

    Any help appreciated,
    Crusy

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Are you sure?

    Try logging the response in an inline success handler seperately in each call.

  3. #3

    Default

    Quote Originally Posted by Animal View Post
    Try logging the response in an inline success handler seperately in each call.
    you mean something like

    Code:
    function retrieveFilteredCustomers( categoryId )
    {
    var ajaxRequestCustomer = Ext.Ajax.request
    ({
    url: 'index.php?/' + language + '/shared/ajax/filteredCustomers/' + categoryId,
    disableCaching: false,
    success: function(xx)
    {
    alert(xx.responseText);
    }, 
    failure: function(){}
    });
    }
    ? Same behaviour..

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Well

    console.log("from retrieveFilteredCustomers: " + xx.responseText)

    so you know who's getting what back

  5. #5

    Default

    I already checked the response with Firebug's GET-response display, but I tried your solution just to double check - both requests show the same response.

    Once I open the URLs directly from Firebug (so they are definetly the URLs used by the requests) by right-clicking->"open in new tab", I see the correct response.

    BTW: I'm using ExtJS 2.2, Codeigniter as the server-side framework, Aptana as editor. This is on a local host right now (the one Aptana comes with), I will try the live server in a couple of minutes

  6. #6

    Default

    ...OK, it seems to work on the live-server
    I will digg into this and let you know if I find something. There has to be some reason for this, even if it's Aptana- (or whatever-) based

    Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •