Switch to full style
JQuery Examples
Post a reply

Send parameters using HTTP GET

Tue Jan 01, 2013 8:47 pm

html code
<html>
<head>
<title>Send parameters using GET method</title>

<!--
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
 Note you can download the JQuery package instead of using Google version. --> 
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $.get("JQuery.php",
    {
      name:"Tom Andrson",
      age:"34"
    },function(data,status){
      $("div#div1").html("Data: " + data + "\nStatus: " + status);
    });
  });
});
</script>
</head>
<body>

<button>Send using GET</button>
<div id="div1"></div>
</body>
</html>

JQuery.php:
php code
<?php
   if(isset($_GET['name'])){
   $name=$_GET['name'];
   }
   
    if(isset($_GET['age'])){
   $age=$_GET['age'];
   }
   
     echo "<b>Name=</b> $name, <b>Age=</b>$age <br/>"; 
?>




Post a reply
  Related Posts  to : Send parameters using HTTP GET
 Get value from HTTP POST VARS     -  
 Using java in http connection     -  
 HTTP Server in Java     -  
 http proxy code     -  
 How to open http connection using j2me     -  
 Build distribution applications by remoting(TCP/HTTP)     -  
 HTTP POST msg connection close problem     -  
 Multipart HTTP forms submitter - With Progress Information     -  
 Reference Parameters     -  
 Encoding parameters in URL     -  

Topic Tags

JQuery GET/POST