Does xmlhttprequest keep connection open after request has been processed? Does xmlhttprequest keep connection open after request has been processed? codeigniter codeigniter

Does xmlhttprequest keep connection open after request has been processed?


XMLHttpRequest is an object which let you to request and receive data from server without refreshing the page. It uses HTTP or HTTPS requests. It is basically same as requesting and receiving an HTML page. You may open them synchronous or asynchronous.

XMLHttpRequest.open( Method, URL, Asynchronous, UserName, Password )

Here, Method is HTTP request method to use. See http://www.w3.org/TR/XMLHttpRequest/#the-open()-method

I want to handle simultaneous request.. Can i queue the request(store parameters) ..and in the onreadystate provide function to handle it.. i.e. calling the function that make request recursively? or it's not a good idea at all?

I'd make an array of XMLHttpRequests and handle data and remove XMLHttpRequest from array onreadystatechange. Keep in mind that you will receive a mixed order of asynchronous responses or may not receive a response at all.

When is the connection closed..at what stage?

It is closed right after data is received. Note that keep-alive is about keeping the session alive, not the connection.