Jump to content


Photo

What is Ajax and where should it be used?


  • Please log in to reply
5 replies to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 18 September 2006 - 10:43 PM

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.
~ Mutley.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 19 September 2006 - 01:34 AM

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.

Info: PHP Manual


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 26 September 2006 - 08:07 PM

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.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#4 mrgeorge_22215

mrgeorge_22215
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 October 2006 - 03:11 AM

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.

?



#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 16 October 2006 - 02:55 AM

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.

Info: PHP Manual


#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 October 2006 - 12:47 PM

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.


Try Google Suggest. It works fine for me and I don't have a pretty fast connection.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users