>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

AJAX Using Prototype - ajax request data link function page code tutorials

 
Registered tutorials: 501
Registered Users: 33515



Rating: 0 out of 0 votes cast


  
Category: Ajax and PHP

AJAX Using Prototype

Digg this   Post to del.icio.us

Abstract: In this tutorial you will learn the basics of AJAX using Prototype (A JavaScript framework) and PHP

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

Code :
function ajaxRequest(url,data) {
var aj = new Ajax.Request(
url, {
method:'get',
parameters: data,
onComplete: getResponse
}
);
}
function getResponse(oReq) {
$('Results').innerHTML = oReq.responseText;
}

The code above is a basic function so that when we make an Ajax request we can get data to display on the page without having the page refresh or redirect. When an Ajax request is made, a request is made to the server in the background and sends back data. In the function getResponse you will notice where it says Results, this is the id of the div in which we want the new data to be displayed.

Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 174
Unique Hits: 149


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0.1 0.1 0.4 0.6 2.4 3
Current 0 0 0 0 1 1
Previous 0 0 0 0 3 5
Dec 6 0 0 1 1 2 2
Dec 5 0 0 1 2 2 2
Dec 4 0 0 1 2 6 6
Dec 3 1 1 0 0 3 5
Dec 2 0 0 1 1 1 1
Dec 1 0 0 0 0 0 0
Nov 30 0 0 0 0 2 2
Nov 29 0 0 0 0 4 6
Highest 5 7 12 14 32 37


Script Execution Time: 0.23731 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2