• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AJAX

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does any one have implemented AJAX (Asynchronous Javascript And XML)???

Can any one tell the basic logic behind it???

Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is plenty of information out there. Do a serch on Google for what you are looking for. AKA. Ajax Servlets / Ajax JSP / AJAX Double Combo / Etc.

Eric
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax Servlets / Ajax JSP / AJAX Double Combo / Ajax In Action
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I know, I can get detailed material on net but I am looking for a basic idea in user friendly, simple language.

 
Vikrant Pandit
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Check out this Ajax Wiki
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an extremely simple demo which I can post, but unfortunately i do not have access to it at the moment. I'll try to post it in the next day or two.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'll try to post it in the next day or two.


That's so nice of you bartender.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
I have an extremely simple demo which I can post, but unfortunately i do not have access to it at the moment. I'll try to post it in the next day or two.


Thank you so much David.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
 
Brett McLaughlin
author
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I can't resist... if you really are coming to Ajax completely new, then Head Rush Ajax is an ideal book. It takes you from ground zero to a well-rounded Ajax developer, and you'll get a really strong grounding in asynchrony, the role of the browser, data formats, etc. Check it out...

Sorry, self-promotion. But that was too much of a softball to resist :-)

Thanks
Brett
 
Sahul Yasin
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have recently implemented Ajax in my project. Really impressive.

In our portal server application, firing a "dynamic data request" from a portlet was refreshing the whole page & reloaded all the porlets in the portal server page.

By using Ajax, we simply retrieved the data without refreshing the whole page & that improved the system performance.

Regards.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, self-promotion

That is what the book promotion is for
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I emailed the demo to Rathi, but here is an extremely simple demo...

Servlet:
(Takes a request with a number, returns the number and a random number as xml)


Web page:
(clicking the link sends an asnch request, receives and decodes the response then pops the data in an alert box)


The 'net.js' is a modified version taken from Eric's book
Note you need to swap on_error and on_load and remove the underscore before it will work.


Hopefully you know how to join the three together

Enjoy,
Dave.
[ April 29, 2006: Message edited by: David O'Meara ]
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey this is really good, pretty usefull, I think I'll try it out...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,

Can I ask why in the world are you checking
if (http_request.readyState == 4){(http_request.status == 200)

inside the function when the content loader does that before it calls the next step.

Eric
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey it was there when I copied it!
Do you have a recommendation of how it should be?

(Sorry, I copied the ContentLoader part from one of your examples. If you have a problem feel free to remove it)
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The content loader does th check already for the 4 and 200. Look at contentLoader and you will see that. It does the check with the costant holding 4 and then looks for 300. If it is a match it calls your function that handles the request.

So you basically just need to remove the if statements in your code that are performing the same check. Only way that code will be called is it it is complete.

Eric
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah I see what you mean, it was being done in the ContentLoader and the callback method. I had missed that. Thanks
 
Linda Walters
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented an Ajax application to provide "lazy loading" of a tree-like structure that is part of the enterprise IT Service Management (ITSM) product on which I work. The actual JavaScript code is pretty simple because the XML that I get back from the backend server throught the web servlet is rather straight-forward and the DOM parsing features of JavaScript make short work of it. The web servlet side of things was pretty much just a pass through of the request from the browser to the backend server and then passing back the XML from the backend down to the browser.

Even when all laid out nice and pretty, with white space, well placed braces, one statement to a line, comments, etc. the JavaScript code is only about 750 lines.

It was much easier than I had expected.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic