Hello Reader's! If you want to send variables from PHP to jQuery then you have to use the selectors:-
Lets's see the example below:-
This you have to put in the bottom of php page with the selector is "input[type=checkbox]"
$("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";
?>
Now every time you give input in the php file it will pass it to another page.
0 Comment(s)