AJAX program can be developed through jquery library. JQuery facilitates less code to implement AJAX.Following is simple code to understand AJAX with JQuery.
Client Code
---------------------------------
<html>
<head>
<title>JQuery AJAX</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#show").click(function(){
$("#message").load("welcome.php");
});
});
</script>
</head>
<body>
<div>
<table>
<tr>
<td><input type="button" value="Show Message!" id="show"/>
<td id="message"></td>
</tr>
</table>
</div>
</body>
</html>
Server Code
-----------------------------
"Welcome.php"
<?php
echo "Welcome!";
?>
No comments:
Post a Comment