I have this code which I use to post variables with ajax.
I am passing a radio button, and it takes one value, I mean it doesn't take the selected values, it takes one by default.
Here are my codes: HTML
<input type="radio" id="status" name="status" value="1" /> Mbyllur<br />
<input type="radio" id="status" name="status" value="0" /> Hapur<br />
Javascript
var js_status = $("#status").val();
It takes the first value. What am I doing wrong? Thanks
PHP
$postStatus = filter_var($_POST["postStatus"], FILTER_SANITIZE_STRING);
You've given them both the same ID. When you're searching it by ID, which one is it to reference?
You want something like this:
var js_status = $('input[name=status]:checked').val()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With