Total members 9950 | Gratitudes |It is currently Sat Feb 11, 2012 2:33 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: The Ajax roundtrip
PostPosted: Thu Jul 30, 2009 9:48 am 
Offline
Newbie
User avatar

Joined: Fri Jun 26, 2009 5:50 am
Posts: 23
Has thanked: 0 time
Have thanks: 1 time

Hi,
An Ajax interaction begins with a JavaScript object called XMLHttpRequest. As the name suggests, it allows a client-side script to perform HTTP requests, and it will parse an XML server response. The first step in this Ajax roundtrip is to create an XMLHttpRequest instance. The HTTP method to use for the request (GET or POST) and the destination URL are then set on the XMLHttpRequest object.

Now, remember how that first a in Ajax stands for asynchronous? When you send that HTTP request, you don't want the browser to hang around waiting for the server to respond. Instead, you want it to continue reacting to the user's interaction with the page and deal with the server's response when it eventually arrives. To accomplish this, you can register a callback function with the XMLHttpRequest and then dispatch the XMLHttpRequest asynchronously. Control then returns to the browser, but the callback function will be called when the server's response arrives.

On the Java Web server, the request arrives just like any other HttpServletRequest. After parsing the request parameters, the servlet invokes the necessary application logic, serializes its response into XML, and writes it to the HttpServletResponse.

Back on the client side, the callback function registered on the XMLHttpRequest is now invoked to process the XML document returned by the server. Finally, the user interface is updated in response to the data from the server, using JavaScript to manipulate the page's HTML DOM. Figure 1 is a sequence diagram of the Ajax roundtrip.

_________________
Thanks & regards
Lokananth
[url "http://www.mioot.com"]Live Chat Software[/url] By miOOt


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Sending One lakh character in ajax  AJAX  Anonymous  0
 Ajax Source code to Suggest application with JSP Server side  AJAX  msi_333  5
 [Ajax/PHP] Registration - Check for empty textboxs  AJAX  PF2G  0
 AJAX WITH JSP  AJAX  LAAVANYA  1
 Solution to AJax Cache problem with Internet Explorer  AJAX  msi_333  4

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team