Hi folks!
I have an AJAX call in my jQuery/PHP app. It needs to send some data to a PHP script to process (I have this part working fine).
My jQuery variable:
var form_data = {
urltitle: '<?php echo $urltitle; ?>',
subscribe: $('#subscribe').val(),
comment: $('#commentbox').val()
};
This works fine, the PHP script reads the values of all the variables - except for the 'subscribe' variable. Subscribe is a checkbox, like so:
<input type="checkbox" name="subscribe" checked="checked" value="subscribe" id="subscribe"/>
How can I pass the 'value' of the checkbox to my PHP script? I have a non-AJAX version of this script too, which is almost identical, except on the PHP side I use:
if (isset($_POST['subscribe'])) { /* do something */ }
And that works fine...
Thanks!
Jack