PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of V   MultiAjax   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: MultiAjax
Using AJAX in batch mode
Author: By
Last change: Version 1.01
Date: 13 years ago
Size: 1,045 bytes
 

Contents

Class file image Download
<?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>