<html>
 
<head>
 
<title>Testing iAJAX</title>
 
<?php
 
    // 1. AJAX class reference
 
    include_once ("cls_iajax.php");
 
    
 
    // 2. AJAX object creation
 
    $iAJAX = new iAJAX;
 
    // 3. ajax.js reference
 
    echo $iAJAX->head_ref ();
 
?>
 
</head>
 
<body>
 
<?php
 
    // 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"]))
 
    {
 
        echo "<div id=\"objeto_modificable\">Initial content</div>\n".
 
            "<a href=\"javascript:void(0);\" ".
 
                $iAJAX->llamada_ajax ("objeto_modificable", "?modo=ajax").">Modify</a> \n".
 
            "<a href=\"javascript:void(0);\" ".
 
                $iAJAX->llamada_ajax ("objeto_modificable", "?modo=inicial").">Reset</a>\n";
 
    }
 
    elseif ($_GET["modo"] == "ajax")
 
    {
 
        echo "Updated content";
 
    }
 
    elseif ($_GET["modo"] == "inicial")
 
    {
 
        echo "Initial content";
 
    }
 
?>
 
</body>
 
</html>
 
 |