Solved

Ajax Multiple Requests and Periodical Updater

Posted on 2009-05-07
2
404 Views
Last Modified: 2012-06-21
Hi,

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.

Thnks
0
Comment
Question by:Nabilbahr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 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://www.perplexedlabs.com/2009/05/04/php-jquery-ajax-javascript-long-polling/
http://en.wikipedia.org/wiki/Push_technology#Long_polling (Just the long-polling part)
<script>
   addResult("blah","blah","blah","blah","blah","blah");
</script>

Open in new window

0
 

Author Comment

by:Nabilbahr
ID: 24480840
Hi,

Can you suggest me a working example of this.

Thanks,
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

687 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