how to save checkbox value using jquery in plugin admin page?

Basically, I want to save values automatically if the user click on a checkbox. I understand that this should be jquery. I am confused though how would jquery interact with wordpress. I can save my other fields (text) by using below code:

if (!empty($_POST)) {
update_option(‘my_plugin_options’, stripslashes($_POST[‘inputs’]));
$feedback = ‘<div class=”updated”><p>Your settings have been saved.</p></div>’;
}

I can do the same for checkbox but I want it to save automatically (onclick). What’s the best way to go about it?

Read more here:: how to save checkbox value using jquery in plugin admin page?

Leave a Reply

Your email address will not be published. Required fields are marked *