1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

multiple ajax requests

Discussion in 'JavaScript' started by Vizuke, Nov 12, 2007.

  1. #1
    anybody have a tutorial on how to make multiple ajax requests?
     
    Vizuke, Nov 12, 2007 IP
  2. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What are you trying to do with it? Most things can be done with one after the other
     
    decepti0n, Nov 13, 2007 IP
  3. Awanish

    Awanish Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's right decepti0n, it may not be worth making multiple requests at a time. Also, you window is the only listener, so you would like to avoid bottle neck.
     
    Awanish, Nov 13, 2007 IP
  4. Vizuke

    Vizuke Peon

    Messages:
    339
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have 2 different div's that returns a responseText. I tried calling the requests one after another buy somehow only the 2nd div is updated. The first one is inact. I'm not sure why this is happening. I have it set up like this.

    [ link ]

    A user clicks the link and it calls an ajax request to update <div id="test1">.
    The same function called by clicking the link will call another ajax request after the first request to update <div id="test2">.

    Anybody can help me solve this?
     
    Vizuke, Nov 14, 2007 IP
  5. fahlyn

    fahlyn Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    could you do it in a single ajax request and just return 2 different sections of xml...then parse the xml for div1 into div1 and the xml for div2 into div2..or you could use JSON.

    if you're not interested in that you could always have something like the following

    1. user clicks the link
    2. javascript kicks off ajax call 1
    3. browser gets reply from server
    4. javascript updates div1
    5. javascript kicks off ajax call 2
    6. browser gets reply from server
    7. javascript updates div2

    and please tell me that you're using prototype.js!

    Happy coding!
     
    fahlyn, Nov 15, 2007 IP
  6. koolman

    koolman Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I know this topic is old, but if anyone still interests in Multiple Ajax Request and using PHP, please try KoolAjax control

    Here is example of multiple requests: http://www.koolphp.net/support/demos/#koolajax.example_simultaneous_requests

    Or you may see this examples, 9 multiple requests at same time: http://www.koolphp.net/support/demos/#koolajax.example_loading_panel
    (Try to click other boxes when some boxes are loading)

    In the second example, you may find out that there is absolutely no javascript involved.
     
    koolman, Mar 19, 2009 IP
  7. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Or you can simply use my AJAX requests class :) It has a very simple functionality, yet you can do a lot of stuff with one-line requests. Create as many requests as you like, each requires just a single line of code
     
    xlcho, Mar 19, 2009 IP
  8. basecore

    basecore Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    classes like jquery and mootools would be very helpful here
     
    basecore, Mar 19, 2009 IP