Send variable to PHP and reload using jquery?
<p>I am completely new to all of this coding.. so I apologies for my ignorance in advance.</p>

<p>I have this jquery function (button) which changes the size of the table of where my Post.php is loaded, (to alternate between portrait and landscape). the function itself works great in changing the size however i am stuck in reloading the post.php page.</p>

<pre><code> $("#cSize").toggle(
 function () {
 $('#p_CWidth').animate({width:720});
 $('#p_SWidth').animate({width:110});
 }, function() {
     $('#p_CWidth').animate({width:520});
 $('#p_SWidth').animate({width:310});
 });
</code></pre>

<p>what i need to add to this code is away of changing the variable p_Type to true or false and reloading the post.php or the div p_Post</p>

<pre><code> &lt;div id="p_Post"&gt;
 &lt;? $p_type = true;
 include 'profile/post.php'; ?&gt;
 &lt;/div&gt;
</code></pre>

<p>post.php with the above code is loaded fine and i tested it by manually changing p_type to false/true and it loaded ok. But how can i get this automated with the jquery functoin above?</p>

<p>I have tried .load('profile/post.php') however this brings me an error for db access!!</p>

<p>any help is really appreciated
AB</p>

<h1>UPDATE</h1>

<p>I have changed my php file to just a simple php without any link to mysql for testing, and i have tried the suggested code:</p>

<pre><code>var p_type = false;
$("#cSize").toggle(function () {
   $("#p_post").load('profile/post.php',{ 'p_type' : p_type }, function { 
       p_type = !p_type; //toggle the value for automation
});

   $('#p_CWidth').animate({width:720});
   $('#p_SWidth').animate({width:110});

});
</code></pre>

<p>and sadly that doesnt seem to work?!!</p>

<p>but with some trial and error i have manged to get change in size working again, and the php reloaded for the first time with the new right variable (p_type), however for some reason the php file only loads once! so it doesnt go back to the normal size with (p_type as true after being set as false)??? here is the code:</p>

<pre><code>   $("#cSize").toggle(
    function () {
  $('#p_CWidth').animate({width:720});
  $('#p_SWidth').animate({width:110});
  $("#p_Post").load('profile/p_post.php',{ p_type : false });
}, function() {
      $('#p_CWidth').animate({width:520});
  $('#p_SWidth').animate({width:310});
  $("#p_Post").load('profile/p_post.php',{ p_type : true });
   });
</code></pre>

<p>Thank you again in advance</p>

<p>ps. here is the toggle example i followed <a href="http://jsfiddle.net/6FMZY/" rel="nofollow">http://jsfiddle.net/6FMZY/</a></p>
