.prop()
method return boolean type. True or false. You should send checked value and save it into database. And in HTML get your value and set it to your checkbox.
An example you have <input type="checkbox" name="test" class="checkbox" value="checked">
. You should send to php $('.checkbox').val();
and then place checked attr to html.
<?php $checked = 'your var from database'; ?>
<input type="checkbox" <?php checked('checked', $checked); ?> name="test" class="checkbox" value="checked">
Something like this should work.
Related Posts:
- Can JavaScript connect with MySQL?
- ASP.NET MVC controller actions that return JSON or partial html
- How to cache json with wp-super cache
- Why use wp_send_json() over echo json_encode()?
- Get Previous & Next posts by Post ID
- WordPress function that makes HTML safe to be sent via AJAX request
- AJAX Implementation
- Custom ordering fails after AJAX post filter
- WP REST API route request explain
- How to use wp_send_json_error?
- Most performant way of fetching remote API data?
- json encode not work in wordpress
- Unable to parse JSON response from wp_send_json_success [closed]
- Updating a checkbox value to database for specific row in table
- How to handle 400 status in Ajax [duplicate]
- Ajax store response json in variables
- How do I query posts by a sub value with the API?
- Cache wp-json/posts without a plugin?
- MySQL select query with ajax
- merge wp rest api query to get posts per category does not work
- Retrieve JSON file from JS trough php
- Upload data from weather station to WordPress Website
- Sql formatting for post data within function
- How can I wp_send_json data?
- Full Front End, AJAX comment system and comment reply script
- Chained ajax call, second call returns 0
- Display full WordPress post under search form using AJAX
- Can I use application/json content type in WordPress
- Using wp_send_json_success instead of $result[‘message’], die, etc
- Not getting ajax success response on insert/update row to database
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]
- Issue developing an AJAX form with WordPress
- How to inject data content from external json into a modal, using UIkit?
- how to correctly use json_encode with ajax
- WorddPress website admin part not working correctly – I think ajax/json issue
- 403 error for ajax POST request
- Ajax WordPress pass post URLs
- How to populate data from JSON using AJAX in TypeScript? [closed]
- Error while submitting form using AJAX and php
- WordPress Ajax JSON success return no being recognized
- Ajax contact form returnig 0
- AJAX Call in Plugin Returns More than JSON
- Usage of wp_send_json_success and wp_redirect at the same time
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
- How to use Ajax with WordPress
- JQuery UI Autocomplete/Autosuggest WordPress
- How to show custom fields in modal in category page
- JSON parsing error syntax error unexpected end of input
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- jQuery AJAX cross domain
- Jquery Ajax Posting JSON to webservice
- Basic example of using .ajax() with JSONP?
- TypeError: $.ajax(…) is not a function?
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- JSON.parse() not working
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- JavaScript implementation of Gzip
- jQuery: Performing synchronous AJAX requests
- jQuery’s .on() method combined with the submit event
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- Ajax takes 10x as long as it should/could
- How to check if I am in admin-ajax.php?
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- Load minimum WordPress environment
- Why use admin-ajax.php and how does it work?
- How to get a unique nonce for each Ajax request?
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Why not register shortcodes if is_admin dashboard?
- WordPress AJAX with Axios
- Why is die() used at the end of function that handles an Ajax request?
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Making my AJAX powered WordPress Crawlable
- Is there a JavaScript API? How to access public and private data in JS?
- failed to load wp-admin/admin-ajax.php
- Using Backbone with the WordPress AJAX API
- Using Ajax with a Class file
- Ajax in a settings page (update_option is undefined)
- How to pass data parameter to ajax action function handler
- WordPress Ajax Data Security
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- Ajax and autocomplete
- How to add to cart via AJAX Woocommerce [closed]
- Nonces and Cache
- SSL breaks customizer: page isn’t returned from ajax
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?