Go Premium for a chance to win a PS4. Enter to Win


Ajax Multiple Requests and Periodical Updater

Posted on 2009-05-07
Medium Priority
Last Modified: 2012-06-21

I am trying to make an application using PHP (NuSOAP) and JavaScript. Its a Flight Booking Engine works same as Kayak.com search engine.

What i am trying to do is to make a queue of Availability Messages to be sent to Server via NuSOAP. There will be various availability responses from this message queue. Instead of showing responses of all messages at once, i want to show them as and when the response starts coming.  Like when the first response comes from server it updates a div on my availability page, few soconds later when second response comes it again updates flight div on availability page, it goes like untill request queue is empty.

The desired response from Availability Server is a Javascript Array of diffrent flight options, at present i am making this JS Array from a PHP page then calling a JS function to make the availability page from that JS function. In New version i am trying to get Javascript Array from Server and pass it onto PHP page for further processing and making availability page, when next response comes from Server, it again adds to the existing Array, sort it then make the availability page.

I am looking for suggestions, how i can aoomplish this.

Question by:Nabilbahr
LVL 20

Accepted Solution

ChristoferDutz earned 2000 total points
ID: 24334054
In this case you have three options: Streaming connection using something like Flex's Socket-Connection, long polling or normal polling.

Well the easiest way would be to use a long polling using a long running HTTP request. In this you write the first part of your response flush it and wait for further responses to drop in. Every time a new response comes in you send the Data in a new <script> tag which contains the data, eventually rapped in a function-call and flushing every time a script tag is output.

http://en.wikipedia.org/wiki/Push_technology#Long_polling (Just the long-polling part)

Open in new window


Author Comment

ID: 24480840

Can you suggest me a working example of this.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question