title: How do I pass data to a php file using jquery AJAX
body: <p>I'm new to using AJAX methods and am completely stumped with what seems like a very simple procedure.</p>
  
  <p>I'm trying to post data to a php file using AJAX in order to create a folder on my server. No matter what I try it seems as if it's not actually posting data to the php file. I can end up creating a folder directly into the 'users' folder if I remove the $_POST command from the php file... but the second I try to actually create a variable from the posted data so it creates the folder inside of a nested subfolder it fails.</p>
  
  <p>please please please help. I'm losing it. haha.</p>
  
  <p>Someone suggested another thread to solve the problem below... but it still doesn't seem to be working. I'm using the same approach that is suggested in that thread.</p>
  
  <p>Here is my script:</p>
  
  <h2>JQuery</h2>
  
  <pre><code>&lt;script type="text/javascript&gt;
      $('#buildSave').click(function() {
          $.ajax({
              url: "../php/preparesave.php", 
              type: "POST",
              data: { user : 'Tommy' }
          });
      });
  &lt;/javascript&gt;
  </code></pre>
  
  <h2>PHP</h2>
  
  <pre><code>&lt;?php
      $user = $_POST['user'];
  
      if (!file_exists('../users/' . $user . '/Platoons/')) { mkdir('../users/' . $user . '/Platoons/'); } 
  
  ?&gt;
  </code></pre>