radio buttons and cookie settings
Posted
by
Cola
on Stack Overflow
See other posts from Stack Overflow
or by Cola
Published on 2012-09-26T21:29:21Z
Indexed on
2012/09/26
21:37 UTC
Read the original article
Hit count: 327
I don't know nothing about cookies and how to set them and i need some advice. I have this 2 radio buttons. For example if an option is changed from one to another, that option will remain even if the page is refreshed or changed on other pages where this radio buttons exist , and i need to make the cookie setting for this code. Can someone can give me an advice what code should i add to my php? thanks This is js code:
$(document).ready(function() {
$('radio[name=radio]').each(function() {
$(this).click(function() {
my_function();
});
});
});
my_function()
{
var value_checked = $("input[name='radio']:checked").val();
$.ajax({
type: 'POST',
url: 'page.php',
data: {'value_checked':value_checked},
});
}
html code
<form>
<div id="radio">
<input type="radio" id="radio1" name="radio" checked="checked" /><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" /><label for="radio2">Choice 2</label>
</div>
</form>
© Stack Overflow or respective owner