I am having a problem getting data from jquery into a php script. I am trying to load a php script (i.e. send an email) with a variable (email address) from jquery event without leaving the original page and going to a confirmation page. Please help!
Here is my jquery code:
<script>
$("#test").click(function() {
var id = 1;
$("#target").load("javascript_test2.php", id);
});
</script>
<div id="target">hmmm did it work?</div>
</body>
This is the php I would like to receive and process the code:
<div id="S1">
<?php
$id = htmlspecialchars($_POST['id']);
for ($i=1; $i<=2; $i++) {
echo $id . 'Hello world ' . $i . '<br>';
}
require_once('lawyeralertemail.php');
?>
</div>
Thanks!