• I called a Hook from the order received page and want to collect the JS data from user and pass it back to PHP to use the variable.

    I tried to call with:

    <script>
          jQuery.ajax({
          type: "POST",
          url: window.location,
          data: { test:"test" },
          success: function( data ) {
            alert(data);
          }
        });
    </script>

    and this to get

    echo $_POST['test'];

    but it is not working, the data is successfully posted but PHP cant read the variables.
    Anybody know how to do it? Thanks for your help

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Pass JS Variable to PHP’ is closed to new replies.