<?php 
include_once '../MultiAjax.class.php'; 
 
class ExampleMultiAjax extends MultiAjax { 
    public function example_echo($data) { 
        return $data; 
    } 
} 
 
$ma = new ExampleMultiAjax(); 
if ($result = $ma->dispatch()) { 
    die($result); 
} 
?> 
 
<html> 
<head> 
    <title>MultiAJAX DEMO</title> 
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
    <script type="text/javascript" src="/MultiAjax.js"></script> 
</head> 
<script> 
function test_send() { 
    multiajax.send({ 
        url:      '/examples/example.php', 
        handler:  'example_echo', 
        data:     document.forms[0].ti.value, 
        callback: function(result) { 
            document.forms[0].ta.value += 
                              (result.error ? result.error : result.data) + '\n' 
        } 
    }) 
} 
</script> 
<body> 
<form> 
    <textarea name="ta" rows="20" style="width:700px"></textarea> 
    <br><br> 
    <input name="ti" style="width:650px;"> 
    <input type="button" onclick="test_send()" value="Test" style="width:45px"> 
</form> 
</body> 
</html>
 
 |