jQuery-将变量传递给php

I'm very new to this and I've searched around all day today to get it working but I haven't managed to find a way to use a variable, only hard-coded values work. Here is my code with a hard-coded value:

<script type="text/javascript">
  FB.Event.subscribe('edge.create',
    function(response) {
      $.post("http://www.my-domain.com/fbtest.php", { category: "845" } );
      }
  );
</script>

What I'd like to have is change that 845 value to a variable called $vpostid. When I change it to that it doesn't work, so I assume I need to get the double quotation marks around the number but I can't see to get the correct combination.

I'm assuming you mean "pass variable from php":

If short hand openings are enabled:

<script type="text/javascript">
  FB.Event.subscribe('edge.create',
    function(response) {
      $.post("http://www.my-domain.com/fbtest.php", { category: "<?=$vpostid?>" } );
      }
  );
</script>

else:

<script type="text/javascript">
  FB.Event.subscribe('edge.create',
    function(response) {
      $.post("http://www.my-domain.com/fbtest.php", { category: "<?php echo $vpostid; ?>" } );
      }
  );
</script>

try this code:

<script type="text/javascript">
  FB.Event.subscribe('edge.create',
    function(response) {
      $.post("http://www.my-domain.com/fbtest.php", { category: "<?php echo($vpostid); ?>" } );
      }
  );
</script>