Jump to content

Archived

This topic is now archived and is closed to further replies.

Mutley

What is Ajax and where should it be used?

Recommended Posts

The answer is probably a Google away but I want a more discussable answer. :)

I hear Ajax is used alot by Google, it's a user interface, like Gmail, using Javascript and PHP/XML? Would I be correct in saying that? It sounds like a fairly new method of coding, well I only first heard of it in the last few months so I would be intrested in getting into it.

Share this post


Link to post
Share on other sites
It's actually been around for a long time... but it's just now starting to catch on.  Google uses it a lot in GMail and other applications (google maps for instance) to refresh the page without reloading the page.

There are plenty of places to use it:

1) Loading new parts of a form based on user selection
2) Grabbing the city/state from a zip code that was entered
3) automatically suggesting things when typing into a box for a search

and the list goes on.  I mainly use it to refresh lists or items where a user can pick and choose their options.

Share this post


Link to post
Share on other sites
In a nutshell, anywhere you want to refresh the contents of part of a page in response to some action without having the overhead of submitting the page and refreshing the whole content.

Share this post


Link to post
Share on other sites
I still do not understand the advantage of AJAX because

1) "Loading new parts of a form based on user selection" can be done with plan JavaScript


2) "Grabbing the city/state from a zip code that was entered" JS as above, but with the addition of a hidden frame (which is reloaded, gets info from server, and DOM sends the result back to the presentation page.

3) "automatically suggesting things when typing into a box for a search" Now that one is a little tricky, because if you have to communicate with the server for every letter pressed, well, my connection, even using T1 is too slow for that to ever be a real help. However, I do notice my yahoo search bar doing that, and it is obvious there that the bar comes preloaded with some suggestions, which are actually provided browser side, and not by looking the combo of letters up from a server search engine with each new letter typed. Now I can't prove that. But my connection is too slow, and the suggestions too predictible.

So, I am still not seeing the advantage of using AJAX, though I do want to learn more about just what it is. Maybe it does what I have already been doing, but with less code. Or maybe some platforms don't like DOM.

?

Share this post


Link to post
Share on other sites
I think you're missing the point.  To do all of those things completely with JS, you have to download all the options ahead of time and manage that all on the client.  So you're not really saving anything. 

In reply:

1) What if the part of the form that needs to be loaded is depending on calculations on the server?  A lot of my work applications involve loading a TON of data into a dropdown or something and it doesn't make sense to load ALL of those options on the first call.  It allows the developer to present a plethora of information without sacrificing the user's bandwidth, or the server bandwidth for that matter.

2) Hidden frames are another item altogether and that's like comparing apples to oranges.

3) It is AJAX in one form or another.  Maybe you need to do some testing on AJAX apps to see how fast they really are.

Share this post


Link to post
Share on other sites
[quote author=mrgeorge_22215 link=topic=108557.msg452008#msg452008 date=1160881886]
3) "automatically suggesting things when typing into a box for a search" Now that one is a little tricky, because if you have to communicate with the server for every letter pressed, well, my connection, even using T1 is too slow for that to ever be a real help. However, I do notice my yahoo search bar doing that, and it is obvious there that the bar comes preloaded with some suggestions, which are actually provided browser side, and not by looking the combo of letters up from a server search engine with each new letter typed. Now I can't prove that. But my connection is too slow, and the suggestions too predictible.
[/quote]

Try [url=http://labs.google.com/suggest]Google Suggest[/url]. It works fine for me and I don't have a pretty fast connection.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.