title: Passing variable from jquery to php
body: <p>i want to pass a variable from jquery to php but my code doesnt work .I tried very hard but no luck . When i click the button nothing happens.plz help thank you</p>
  
  <p>one more thing i tried this without passing variable and i use only echo command then it works but when i pass variable nothing happens</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
       &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
     $("button").click(function(){
      var var_data = 5;
       $.ajax({
          url: "myscript.php",
          data: { var_php_data: var_data },
          success: function(data) {
              // do something;
                                alert(data);
          }
   });
    });
     &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
  
  &lt;button&gt;Change Content&lt;/button&gt;
  
     &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>myscript.php contains the following code</p>
  
  <pre><code>    &lt;?php
    echo $_GET['var_php_data'];
     ?&gt;
  </code></pre>