Getting Started
Do you want to take the leap into the world of Ajax (Asynchronous JavaScript and XML) but don't know where to begin. Well I was in your situation. I came across prototype.js a nifty little JavaScript file that makes Ajax calls so easy you can do it within a few minutes. The first step you need to do is download the prototype.js file from http://www.prototypejs.org/. Put this JavaScript file in the directory of the website you wish to add Ajax to. The next step is implementing the Ajax.
Including Ajax and Creating Request Function
In your head include the prototype.js file like so...
Next we need to create a request function for when a Ajax Request is made...
function ajaxRequest(url,data) {
var aj = new Ajax.Request(
url, {
method:'get',
parameters: data,
onComplete: getResponse
}
);
}
function getResponse(oReq) {
$('Results').innerHTML = oReq.responseText;
}
1 2 Next Print