|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi guys. I'm just getting started with ajax to use with PHP.
i'm reading a book that begins with some examples of where ajax can be used. One of these examples was when you select a country in a form, ajax dynamically returns the areas of that country in the next box. This could obviously be done in javacript alone so what is the difference and benefits of using ajax for this particular example and similar situations?? cheers Anthony |
|
#2
|
||||
|
||||
|
Fetching only the necessary content?
If there's a lot of content you would be fetching it from php in the first place and printing it onto the page for the javascript to work. In some cases that can be an awful lot of data. In some cases it may be fetching it off a different site where it's split into seperate sections so programmatically it would be an advantage. fwiw, I think ajax is overused, i've seen entire sites written in ajax and that's ridiculous, you lose the ability to link to a specific page and you completely cut out older browsers that don't do ajax. Use ajax where it is the best solution to a problem and nowhere else.
__________________
~James [Not currently seeking freelance work] Like philosophy or interested in spirituality? Philosophorum. Game Dev Experts Forums Foresight Linux - Because your desktop should be cool! Linux FAQ FedoraFAQ UbuntuGuide |
|
#3
|
||||
|
||||
|
The J in AJAX stands for Javascript. There's no difference.
-Simon
__________________
|
|
#4
|
|||
|
|||
|
Hi guys thanks for your replies
Linux Penguin - yea that's pretty much what I thought. I wouldn't consider doing whole sites with ajax. I'm just looking at for improving a few UI features SImon - There's no difference?? I knew it stood for javascript but I thought it combines javacript and XML to enhance javascripts abilities. E.g. Is this ajax form possible in javascript?? never tried it: http://ajaxphp.packtpub.com/ajax/quickstart/ cheers |
|
#5
|
|||
|
|||
|
Quote:
AJAX doesn't enhance Javascript. It relies on it. Javascript is a client side technology. It is purely run on the browser. But a lot of data and logic is on the server. AJAX can be thought of as interface between the technologies. |
|
#6
|
||||
|
||||
|
AJAX just uses javascript to communicate with the server in the form of XML. That's all. There's no magical difference between javascript and AJAX, AJAX is an implementation of javascript.
As LP said, it's great for making sites a bit more responsive. Common examples include filling in drop down sub menus based on the users choice. For example, "please select which country you live in" -> "and the city". The non ajax-y way would be to either load all possible citys for all countries (large and slow), and swap between them with something like an onSelect. Using ajax you can wait for the user to select the country, and bounce back to the server to get the city list, and then swap it in. Should send less data to the user, and be a bit more responsive. --Simon |
|
#7
|
|||
|
|||
|
Hi guys. thanks alot for your responses. I think I get what Ajax is all about now.
cheers |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Ajax vs javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|