Login   Register  
PHP Classes
elePHPant
Icontem

File: tests/inline_call.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Guilherme Blanco  >  pAjax  >  tests/inline_call.php  >  Download  
File: tests/inline_call.php
Role: Example script
Content type: text/plain
Description: Inline call first test
Class: pAjax
Do RPC calls from the browser without page reloads
Author: By
Last change: - Updated tests to allow working with disabled domain protection and with
enabled export protection
Date: 8 years ago
Size: 951 bytes
 

Contents

Class file image Download
<?php

require_once "../class.pAjax.php";


function 
foobar() { return "foo"; }


$AJAX = new pAjax;
$AJAX->disableDomainProtection();
$AJAX->enableExportProtection();
$AJAX->export("foobar");
$AJAX->handleRequest();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>Inline Ajax Call Example</title>
    <?php $AJAX->showJavaScript(".."); ?>
  </head>

  <body>
    <h1>Inline call test with no arguments</h1>
    <p>Call the function 'foobar' on server and get its response</p>
    <script type="text/javascript">
        var func = function (e) {
            // "e" is the content of pAjax.getResponse()
            alert(e);
        }
    </script>
    <input type="button" onclick="pAjaxCall(null, 'foobar', func)" value="Click me!" />
  </body>
</html>