Login   Register  
PHP Classes
elePHPant
Icontem

File: Example.MyAjax.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Adnan Alabuo  >  My Ajax  >  Example.MyAjax.php  >  Download  
File: Example.MyAjax.php
Role: Example script
Content type: text/plain
Description: Example
Class: My Ajax
Generate HTML to update pages using AJAX
Author: By
Last change:
Date: 6 years ago
Size: 1,603 bytes
 

Contents

Class file image Download
<?php

if (!empty($_POST['Text'])) {
    
sleep(10);
    print 
$_POST['Text'];
    exit;
}


if (!empty(
$_GET['Text'])) {
    
sleep(10);
    print 
$_GET['Text'];
    exit;
}


include(
'class.MyAjax.php');

?>

<html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>صفحة جديدة 1</title>
<script language='javascript'>
var PageName = 'Example.MyAjax.php';

function NotEmpty1() {
    
    if (document.f.T1.value == ''){
        alert('Plz Fill This Field')
        document.f.T1.focus
        return false
    } else {
        return true
    }
}

function NotEmpty2() {
    
    if (document.f2.T1.value == ''){
        alert('Plz Fill This Field')
        document.f2.T1.focus
        return false
    } else {
        return true
    }

}
</script>
<?
$MyAjax 
= new MyAjax;

$MyAjax->PrintGetFunction('MyGetFunction','GETZONE');
$MyAjax->PrintPostFunction('MyPostFunction','POSTZONE');
?>
</head>

<body>

<table border="1" width="684" height="96">
    <tr>
        <td height="42" width="50%">
        
        <div id="GETZONE">
        <form name="f">
        <input type="text" name="T1">
        <input type="button" value="إرسال" onclick="javascript:if (NotEmpty1()) { MyGetFunction(PageName+'?Text='+document.f.T1.value,true) }">
        </form>
        </div>
        
        </td>
    </tr>
    <tr>
        <td height="42" width="50%">

        <div id="POSTZONE">
        <form name="f2">
        <input type="text" name="T1">
        <input type="button" value="إرسال" onclick="javascript:if (NotEmpty2()) { MyPostFunction(PageName,'Text='+document.f2.T1.value,true) }">
        </form>
        </div>
        
        </td>
    </tr>
</table>

</body>

</html>