title: Using jQuery .serialize() within ajax array to pass the PHP $_POST as Variables?
body: <p>This is the jQuery code i'm using to send the form details to a php function:</p>
  
  <pre><code>jQuery(document).ready(function($) {    
      jQuery('.submit').click(function(){
          var str = $("#ajaxForms").serialize();
          var data = {
              action: 'myajax-submit',
              serialize: str,
              beforeSend: function(){
                  alert('Sending...');
              }
          };  
          jQuery.post(MyAjax.ajaxurl, data,  function(response) {
              alert('Got this from the server: ' + response);
          });
          return false;   
      });
  });
  </code></pre>
  
  <p>and this is the php function:</p>
  
  <pre><code>function myajax_submit() {
      $whatever = $_POST['serialize'];
      echo $whatever;
      die(); 
  }
  </code></pre>
  
  <p>Everything works, but when the alert box appears the text displays a string of values from my html form <code>#ajaxForms</code>. I believe this is because the php function echos the <code>$_POST['serialize']</code>.</p>
  
  <p>In my form i have an input box such as:</p>
  
  <p><code>&lt;input id="postID" name="postID" value="First Name" type="text"  /&gt;</code></p>
  
  <p>but when i try echo the <code>$_POST['postID']</code> variable in the php it doesn't display anything in the alert box.</p>
  
  <p>I thought by sending the form data serialized to the php function i could use the $_POST variable associated with the form inputs?</p>
  
  <p>Help appreciated. :)</p>