how to get jquery $.post variables via php $_POST?

how to get jquery $.post variables via php $_POST?

Hi,
I have php and js code. In JS part there are some variables set, when user selects options, and I want to get them in PHP. So I used jQuery "$.post" function, like this:

 $(document).ready(function() {
              $.post("my_page.php", { product_t: "29"},                   
                    function() {
    alert('Your data has been saved.');
});
 });

What I am going to achive is to get variable 'product_t' in PHP. So I was expecting to have it in $_POST['product_t']; but it's empty:(

Where is the problem?
Thank you.

BTW "my_page.php" is the same page where above code is placed, is it ok?















    • Topic Participants

    • info