views:

120

answers:

5

AJAX - Asynchronous JavaScript And XML

What does it include ? html, javascript, XML, jQuery ...........

What is the way to start learning AJAX ? Is it basic from html & javaScript ? or on the basis of the language platform ?

+1  A: 

AJAX = Asynchronous JavaScript and XML.

So basically it is javascript. jQuery among other things simplifies your code sending AJAX requests. HTML is markup, not language and is not related to AJAX.

You may start with this tutorial.

Darin Dimitrov
A: 

By actually using it. Is the best way of learning something. ANY thing!

Ionut Staicu
+2  A: 

You Need to have knowledge of HTML and Javascript. W3Schools has a Tutorial on Basics which will help You learn. The best way to learn is to put some code and use it. And Moreover now, JQuery ( a javascript library ) , makes learning Ajax more fun and easier. The Website has good documentation and some Sample Ajax code too.

JWhiz
A: 

You need first to understand Javascript and how to program it. On my side, when I first started to develop Javascript, my experience was mainly C, C++, Perl and the like.

Due to that background, it quickly occur to me the need in Javascript to be able to query data from the current page (without any redirection) to the web server dynamically. I then discovered the usual key Ajax object XMLHttpRequest.

I would recommend you to use the "regular" Javascript at first, perform some basic dynamic actions, like time display, moving text (...).

Then you could try to implement a simple program that display the clock value from your server. Because XmlHttpRequest perform a dialog between the web server and the client (browser).

For that you need to have access to a web server (eg Apache). You need to chose what language you will use server side to answer the Xmlhttprequests, e.g. PHP, Perl CGI, etc... You need to have Apache dispatch the page requests to that PHP ... script. The script will have to output the result.

 Browser-Javascript request 

 ==> Web server (eg PHP) 
     to Display the clock =
                          "
 Back to browser        <==

The the javacript code will get that answer and will have to display that result somewhere.

In terms of Book, Javascript 5 by Flanagan is my first choice.

ring0
+3  A: 

Ajax is, in short, the process of communicating with a webserver from a page, using JavaScript, without leaving the page.

The key things you need to know for this are:

  • The JavaScript needed to make the request and handle the response
  • The server side code needed to receive the request and make the response (unless you are using a service that provides this for you)

The server side of this depends very much on what server side environment you are working with, so there is little useful that is specific that could be said. What can be usually said are what form the responses can take.

  • JSON is a popular approach for sending structured data
  • XML is another way to send structured data, but has been falling out of favour of late since JSON is, arguably, easier to work with.
  • Chunks of HTML are popular for shoving into pages with innerHTML
  • Tiny bits of plain text are useful for simple responses

As for the client side, there are two common approaches.

  • XMLHttpRequest, which is powerful, but limited to requests to the current domain by the same origin police
  • JSON-P, a cross-domain method that works by loading a script from the third party that calls a function defined by the first party with all the data in an argument to the call.

Now for some resources:

David Dorward