title: Automatically send post data to php using jquery on page load
body: <p>I am using WordPress 3.3.1 to grab the post_id from this line,</p>
  
  <pre><code>&lt;div class="mppt_postid"&gt;&lt;b&gt;'.$post_id.'&lt;/b&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and then use jQuery script below to send the post_id number back to a WordPress php file on page load using $_POST['postid'] with AJAX, and then replace the post_id number with the data returned by the php script, which is another number (the visitor count). The jQuery script below is not working, and I am not sure how to trigger .post to automatically send the data when the page is loaded.</p>
  
  <pre><code>jQuery(document).ready(function() {
      var postid = $('div.mppt_postid').attr('b');
      jQuery.post(mppt_ajax_script.ajaxurl, postid.serialize()
      , function(data) {
          jQuery('.mppt_postid').replaceWith(data);
      }
      );
  }); // end ready
  </code></pre>