Tags

  • Server-side Ajax framework that lets you create the JavaScript needed in an Ajax application on the server.
  • Download Sajax: http://www.modernmethod.com/sajax/download.phtml
  • Create JavaScript functions in your Web pages.
  • Sajax can connect those JavaScript functions to the server-side programs that you had coded.
  • The JavaScript that Sajax creates for you takes the data entered in the Web page and sends it to your server-side code to be processed.
  • Creates that Web page on the server and creates all the JavaScript needed to connect your client-side code to code on the server.
  • Handles the connection between the Web page and the code on the server by itself, sending the data to the server-side code and reading the result that code passes back to the browser.

<?php
require("Sajax.php");
 function adder($operand1, $operand2)
 {
 return $operand1+$operand2;
 }
 sajax_init();
 sajax_export("adder");
 sajax_handle_client_request();
 ?>

<html>
 <head>
 <title>Example of Sajax</title>

 <script>
<?
sajax_show_javascript();
 ?>
 function show_results(result)
 {
 document.getElementById("result").value=result;
 }
function do_adder()
{
 var operand1, operand2;
 operand1=document.getElementById("operand1").value;
 operand2=document.getElementById("operand2").value;
 x_adder(operand1, operand2, show_results);
}
</script>

 </head>
 <body>
 <center>
 <h1>Using the Sajax server-side framework</h1>
 <input type="text" name="operand1" id="operand1" value="4" size="3">
 +
 <input type="text" name="operand2" id="operand2" value="5" size="3">
 =
 <input type="text" name="result" id="result" value="" size="3">

 <input type="button" name="check" value="Add" onclick="do_adder(); return false;">
 </center>
 </body>
</html>

Advertisement