Hey Friends,
AJAX Means Asynchronous JavaScript and XML.
AJAX is the art of exchanging data with a server, and updating 
parts of a web page - without reloading the whole page.
Today we Learn About Ajax call Back Function.Its very Nice and Simple script.Its call by JavaScript.Use this Function and See the magic of it.First you have download jquery library.
Jquery Library : Click Here
Example Code(Just run this code and see the magic):
1) test.php
//Add jquery library 
<script language="javascript" src="jquery.min.js"></script>
//create one javascript function
<script language="javascript">
function addNumbers() {
     var number1 = $('#number1').attr('value');
     var number2 = $('#number2').attr('value');
     $.get("data.php", { number1: number1, number2: number2 },
         function(data){
             document.getElementById('data').value=data;
            //alert("Data Loaded: " + data);
     });
}
</script>
<form method="post">
<input type="text" id="number1" value="0" /> + 
<input type="text" id="number2" value="0" />
<input type="button" onclick="addNumbers();" value="=" />
<input type="text" id="data" />
</form>
2) data.php
<?php
echo $_REQUEST['number1'] + $_REQUEST['number2'];
?>

No comments:
Post a Comment
Thanks....