Monday, 17 October 2011

Using Jquery Example:1

First  create  hello.php  and  insert this code


         <?php //echo "responce from server";
                       echo $_POST['cname'];
         ?>

then you need to create an index page with name index.html is as follows


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="javascript" src="jquery.js"></script>
<script language="javascript">
function getvalues()
{
$.ajax({
type: "POST",
url: "hello.php",
data: "id=hi&cname=india",
async: false,
success: function(data){
 //$("#Content").html='';
//$("#Content").html(data.output);
//alert('hello');
alert(data);
}
});

}
getvalues();
</script>
</head>

<body>

</body>
</html>

Now you are going to get jqury.js  (  This is download from net also) 



then you run this script and getting to know how Jquery works


No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...