Today you are going to learn simple jquery value passing example.We have created one html file and when click a link the corresponding values is get from a php file using jquery.All jquery files i have included in source so download it for latest jquery visit http://jquery.com create a html file.



<html>
<head>
<title>simple</title>
<script type="text/javascript" src="niftycube.js"></script>
<script src="jquery.min.js" type="text/javascript"></script>
 <script>

     $(document).ready(function(){
	 Nifty("#menu a","small top transparent");
	 Nifty("#outcontent","medium bottom transparent");
	 $('.content').load('simple.php');
         $('#menu a').click(function() {
		 				$(".content").slideUp("slow");
						 var content_show = $(this).attr("title");
							$.ajax({
							method: "get",url: "simple.php",data: "page="+content_show,

							success: function(html){
							$(".content").show("slow");
							$(".content").html(html);
					 }
				 });
         });
	 });
</script>

</head>

<body>
<b><center><font color="green">Jquery tutorial by <a href="http://s2sgateway.com">http://s2sgateway.com</a></font>
</center>
</b>
<div>

<ul id="menu">
             <li id="about"><a href="#" title="one">one</a></li>
            <li id="portfolio"><a href="#" title="two">two</a></li>

</ul>

</div>

<div class="content"></div>
</body>
</html>

Next create a php file for the values checking functions.In this file for each values corresponding case statement values is sent to the page.


<?php
$p = $_GET['page'];
switch($p) {
case "one":
echo 'sample1';
break;
case "two":
echo 'sample2';
break;
Default:
echo 'click anyone';
}
?>

Download all source Herejquery tutorial by s2sgateway
Happy coding

Related Posts

  1. simple css search box using image
  2. simple update query in jsp page
  3. Simple Struts Example
  4. Sample css Menu With Background image on hover
  5. how to import a csv file values in to database using jsp