Results 1 to 6 of 6

Thread: Sending Multiple Requests At The Same Time In AJAX

  1. #1
    Join Date
    Nov 2009
    Posts
    680

    Sending Multiple Requests At The Same Time In AJAX

    Hello, I am learning the AJAX programming and while learning it, I want to know the details from which I can able to Send Multiple Requests At The Same Time. I have read this question on the internet, but there were no specific solution is given. But, I want to get the solution for it. If anyone is having solution or script to achieve it, then please provide me that. It will be helpful to me.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Sending Multiple Requests At The Same Time In AJAX

    Hey, Same here, On my web page, I have several buttons that send AJAX requests. How should I manage it? I understand that they must send a single Ajax request has a time because we could have problems in some browsers: it's for me to manage or framework does this automatically. I also need this solution, so please provide me some solution from which I can able to get the solution. Thank you in advance.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Sending Multiple Requests At The Same Time In AJAX

    I think you have a option of the Switch to synchronous. This option, blocks any treatment as the previous ajax request is not returned. But it is a solution of last resort, for example:

    Code:
    $.ajax(
    {
      async: false,
      url: 'ajax / test.html',
      success: function(data) 
    {
        alert('Start')
      }
    });

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Sending Multiple Requests At The Same Time In AJAX

    In your json object returned by the server you will have several 'key': 'value' of these elements you are going to spend what you want and get a callback function for javascript. Specifically, if you click on a button:

    Code:
    / / Your function ajax will be the next
     
    $.ajax({
      dataType: "json",
      url: 'ajax / test.html',
      success: function(data) {
        if (data.callback) eval(data.callback + '(' + Data.result + ')' );
      }
    });
     / / Your server will return data in JSON format
    / / Eg ( "result": "Totto is nice", "callback": "myfunc")
    / / When you RECOVERED this server you must have a function myfunc () as follows
     
    function my_function(result)
    {
     alert(result);
    }

  5. #5
    Join Date
    Apr 2008
    Posts
    2,005

    Sending Multiple Requests At The Same Time In AJAX

    If you want to send Multiple Requests at the same time then you can make use of the three ways as follow:
    1. First solution can be the use of the synchronous AJAX requests. If you make use of the synchronous then one connection from the one client will be created.
    2. You can perform the schedule which will help you to create a second connection when one connection closes.
    3. Third and last option can be as the you can collect all of the request.

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Sending Multiple Requests At The Same Time In AJAX

    You can run two simultaneous requests. For cons it is entirely possible that the query returns are not in the same order as that of your ajax calls. That's why the solution using json and a callback function allows you to properly handle returns without worrying about the order to send ajax requests. It can be possible that it will solve your problem.

Similar Threads

  1. Replies: 5
    Last Post: 24-08-2011, 10:29 AM
  2. Getting BSOD saying multiple IRP complete requests
    By Star Skye in forum Operating Systems
    Replies: 7
    Last Post: 19-06-2011, 09:51 PM
  3. Post Multiple Data with Ajax(Jquery)
    By Tyee in forum Software Development
    Replies: 4
    Last Post: 17-06-2011, 10:22 PM
  4. How to keep AJAX HTTP requests under control
    By In2TheBlues in forum Software Development
    Replies: 3
    Last Post: 07-11-2009, 08:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,798,650.86246 seconds with 16 queries