I am having trouble recording the following _session variable inside my jquery function. I essentially want to grab the value of the coupon code and store it there.
<input type="text" oninput="calculate()" name="couponCode" id="couponCode" value="" placeholder="Please Enter Coupon Code" required>
<script>
$(function() {
$("#signInButton2").click(function(){
<?php $_SESSION['userCoupon'] = echo "<script> $('#couponCode').val(); </script>"; ?>
});
});
Thanks in advance
Here is a quick and easy using jSON. I will get a lot of flak for using jSON in this manner, but too bad everyone.
This should work just fine...
$(function()
{
$("#signInButton2").click(function()
{
var temp = $('#couponCode').val();
example(temp)
});
});
function example(number)
{
$.get("example_set_session.php",
{
number: number
});
}
in example_set_session.php...
<?php
$example_number = $_GET['number'];
$_SESSION['userCoupon'] = $example;
?>