"how to pass jquery variables to php variable?" Code Answer

5

Ajax can do this. Google it, and check out api.jquery.com and look at the ajax functions, .ajax(), .post(), .get(), .load(), etc.

As for your specific question, here is what you would do:

//Javascript file
$("input[type=checkbox]").click(function () {
   $.post('my_ajax_receiver.php', 'val=' + $(this).val(), function (response) {
      alert(response);
   });
});

//PHP file my_ajax_receiver.php
<?php
   $value = $_POST['val'];
   echo "I got your value! $value";
?>
By benjiw-5545b5dfdfef on October 18 2022

Answers related to “how to pass jquery variables to php variable?”

Only authorized users can answer the search term. Please sign in first, or register a free account.