.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
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Ajax and autocomplete
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- Saving (Updating) Post / Page Edits With AJAX
- Plupload in metabox – AJAX action not working in Class
- Admin Ajax always return 0 on form submit
- Confused on AJAX submit form through page template
- Ajax call in wordpress not working for subscriber user in front site
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- wp_localize_script escaping my url – fix or alternative
- Insert wp_editor on front-end with AJAX?
- Buddypress: Load Ajax Without Template Pack [closed]
- Woocommerce Ajax Add cart not working
- I have to post data by AJAX in wordpress to another Website
- Placement of add_action() for ajax callback?
- WordPress ajax problem need wordpress expert?
- wp_ajax function did not call
- wp_handle_upload returns empty error array
- database sent to a JSON file
- Single page site + pushState?
- Interim-Login form on frontend
- Save value from Javascript object to WP user
- wp_update_post onclick button using ajax
- add Additional class to woocommerce cart-contents link
- wp_ajax declaration confusing for Front end
- Delete ACF repeater field row on Front End
- No errors in the console but Ajax call doesn’t seem to be working
- Preprocess submitted data
- Update status, meta while inside a post using AJAX button
- Redirect after saving form; and yet use wp_die()
- ajaxt returning object object [closed]
- Load more posts (Ajax) in tabbed sidebar on single.php
- Why is the file not uploading to the server?
- Get localize of a loaded javascript
- REST public POST giving 403 forbidden nginx
- Query data after an Ajax insert
- How to get next and previous post into ajax formed modal windows?
- GET request return value as error instead of success
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Problem when sending file via ajax
- wp_verify_nonce not working on the mobile device
- ajax response strips multidimensional array and unable to decode
- Change button text after ajax db update
- How do I display posts of a specific day?
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- Ajax Function call is always returning 0 in front end(without plugin) [closed]
- Ajax live search, “No products found” when the title contains apostrophes and quotations
- Speeding up admin-ajax.php
- admin ajax is not working for non logged in users
- wp_localize_script not create variable in head section
- Class property not visible inside ajax callback function?
- How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list