title: getting ajax to pass string variable from javascript to php
body: <p>This is the javascript I am using now</p>
  
  <pre><code>&lt;script&gt;
      $( document ).ready(function() {
          var namer = sessionStorage.getItem("namer");
          $.ajax({
              type: "POST",
              url: "Antibiotics2.php",
              data: { 'name': namer }
          }).done(function( msg ) {
              alert( "Data Saved: " + msg );
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>and this is the php:</p>
  
  <pre><code>&lt;?php echo $_POST['name']; ?&gt;            
  </code></pre>
  
  <p>It throws an error and says that the index 'name' can't be found.</p>