title: How do I pass HTML radio button value to a PHP variable using Javascript and Ajax?
body: <p>I am trying to pass the user's checked HTML radio button value to a PHP variable using Jquery/Javascript and Ajax.</p>
  
  <p>The following is a simplified version of the HTML/Javascript (without error checking, etc.) </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;input type="radio"  name="bus_plan" id="smallBtn" value="1"/&gt;
  &lt;input type="radio"  name="bus_plan" id="smallBtn" value="2"/&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function()
  {
      $("input[name=bus_plan]").on('change', function(){
      var $postID = $('input:radio[name=bus_plan]:checked').val();
      $postID = "="+$postID;
      });
      $.ajax ({
         type: "GET",
         url: "localhost/ajax/product-group.php",
         data: {"postID" : $postID }
      });
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The following is a simplified version of the PHP program (localhost/ajax/product-group.php):</p>
  
  <pre><code>&lt;?php
    $postid = $_GET['postID']; 
    echo "The PostID is ".$postid;
  ?&gt;
  </code></pre>
  
  <p>This is running on a MAMP stack.</p>
  
  <p>The Javascript works up until the $.ajax call and then PHP program (localhost/ajax/product-group.php) is never "called".</p>
  
  <p>Any advice or help would be most appreciated.</p>
  
  <p>Thank you.</p>