PHP Classes

File: en/test.php

Recommend this page to a friend!
  Classes of Eduardo Martos Gómez  >  iAJAX  >  en/test.php  >  Download  
File: en/test.php
Role: Example script
Content type: text/plain
Description: Test script
Class: iAJAX
Trigger an AJAX request upon an HTML page event
Author: By
Last change: Bad reference.
Date: 11 years ago
Size: 1,189 bytes


Class file image Download
<title>Testing iAJAX</title>
// 1. AJAX class reference
include_once ("cls_iajax.php");
// 2. AJAX object creation
$iAJAX = new iAJAX;
// 3. ajax.js reference
echo $iAJAX->head_ref ();
// 4. Needed architecture modification:
    // If there's no AJAX call, it shows the container objeto_modificable.
    // If there's AJAX call, it doesn't show the container, but its value.
    // Note 1: This modification of the site's architecture is only a suggestion,
    // not the only way.
    // Note 2: It's recommended to use href="javascript:void(0);", compatible
    // with Mozilla and Trident engines.
if (!isset ($_GET["modo"]))
"<div id=\"objeto_modificable\">Initial content</div>\n".
"<a href=\"javascript:void(0);\" ".
$iAJAX->llamada_ajax ("objeto_modificable", "?modo=ajax").">Modify</a>&nbsp;\n".
"<a href=\"javascript:void(0);\" ".
$iAJAX->llamada_ajax ("objeto_modificable", "?modo=inicial").">Reset</a>\n";
    elseif (
$_GET["modo"] == "ajax")
"Updated content";
    elseif (
$_GET["modo"] == "inicial")
"Initial content";