>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

Simple Ajax using Prototype. Part 2 - ajax php script prototype tutorial server part ajaxupdater

 
Registered tutorials: 501
Registered Users: 33515



Rating: 3.67 out of 3 votes cast


  
Category: Ajax and PHP

Simple Ajax using Prototype. Part 2

Digg this   Post to del.icio.us

Abstract: This tutorial shows how to replace a DOM element using prototype.js javascript library. The PHP is used on the server side

Ajax Updater - Update a DOM element ID from a Server Script

This example is probably the simplest example you will ever find.
We are going to use the prototype feature ‘ajax.Updater’ (see part one for more details on prototype).

ajax.Updater allows you to specify an element ID and script URL - and whatever the script URL prints will appear in your element ID. Simple as that.

The example below simply returns the Server time each time the button is clicked.

I’m not going to explain this bit by bit as it is just so easy to grasp.

Remember, you will need the prototype library in order to use this!!

Here is the HTML/JavaScript code:

  1. <html>  
  2. <head>  
  3. <script src="dist/prototype.js" type="text/javascript"></script>  
  4. <script type="text/javascript">  
  5. function ajaxUpdater(id,url) {  
  6.  new Ajax.Updater(id,url,{asynchronous:true});  
  7. }  
  8. </script>  
  9.   
  10. </head>  
  11. <body>  
  12. <div id="updateme"></div>  
  13.   
  14. <input type="button" value="Update" onClick="ajaxUpdater('updateme','updateme.php')">  
  15. </body>  
  16. </html>  

Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 126
Unique Hits: 101


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0 0 0.3 0.6 1.3 1.9
Current 0 0 0 0 0 0
Previous 0 0 0 0 3 6
Dec 6 0 0 0 0 1 1
Dec 5 0 0 0 0 2 2
Dec 4 0 0 2 4 1 1
Dec 3 0 0 0 0 2 2
Dec 2 0 0 0 0 2 3
Dec 1 0 0 0 0 0 0
Nov 30 0 0 1 2 1 3
Nov 29 0 0 0 0 1 1
Highest 3 4 6 9 13 18


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