Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-11-2009
Member
 
Join Date: Feb 2009
Posts: 53
How to keep AJAX HTTP requests under control

Hi,
I had send multiple asynchronous HTTP requests, and at some point in the process I loaded lose control over it. I am not able to get which requests are actually processed at the moment. The problem here faced by is first for the asynchronous requests, there is no guarantee that the replies to the server lies in the order of questions. And second the monitored onreadystatechange event takes place in the scope of the [window] object, the reference to the object, which was stored the HTTP request. Any suggestions would be appreciated. Thanks.
Reply With Quote
  #2  
Old 07-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: How to keep AJAX HTTP requests under control

The solution often looks that each request is stored in a globally available object, which tit is accessed in the onreadystate function, which is omitted in this variant is described here. You will need to perform two actions here to make things steady. First you have keep control over, but without global variables / objects to use. And second you have to see that no request may be lost and you must able to use variable functions for processing the requests. A observation on the same is needed.
Reply With Quote
  #3  
Old 07-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: How to keep AJAX HTTP requests under control

The object used in addition, I allow myself to create an anonymous function: Code: AJAX = function (args) ( var ajax = args; return ajax; ). By this function it takes as a parameter of an object, which is the basis of him with whom you can work on now. The object here requires no content, but you can you run to requests with different requirements. What information could be good use to run an HTTP request dynamic. For this use following variable things - URL: the address to which the request should be sent, data (optional): to send data, method (optional): the transfer method, POST or GET, GET as the default, onComplete (optional): A function object that is to be invoked if a valid server response.
Reply With Quote
  #4  
Old 07-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: How to keep AJAX HTTP requests under control

How do I do now with these properties slightly and send a request. For this the below syntax will help you a lot. I extend the ajax object is a method that will execute the request on the basis of the existing attributes. The code for it is
PHP Code:
AJAX = function (args

  
   var 
ajax args
   
ajax.request = function () 
   ( 
     / * 
Statements * / 
   ) 
   return 
ajax

The base is hereby, a simple call to the request () method would look like this:
Code:
PHP Code:
AJAX (( 'url''skript.php''onComplete'completeFunction)). Request (); 
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to keep AJAX HTTP requests under control"
Thread Thread Starter Forum Replies Last Post
How to fix HTTP error 307 Temporary Redirect (since HTTP/1.1)? Charu Sharma Networking & Security 6 05-04-2012 01:14 AM
Mission requests out of control in FrontierVille Wayne R Video Games 5 25-02-2011 10:19 PM
jQuery AJAX vs. Adobe AIR AJAX Class Agaev Windows Software 5 06-07-2010 01:59 PM
Sending Multiple Requests At The Same Time In AJAX technika Software Development 5 03-02-2010 09:07 PM
parsing of an AJAX-based HTTP request javascNoob Software Development 1 26-03-2009 07:54 AM


All times are GMT +5.5. The time now is 09:09 PM.