Got the solution:
- Create a PHP file “purge-bb-cache.php”
- Create a JS script like below in functions.php
purge-bb-cache.php
<?php
FLBuilderModel::delete_asset_cache_for_all_posts();
?>
JS script:
// Add JS to customizer
function print_customizer_js() {
?>
<script>
// Purge BB Cache On Save Customizer
jQuery(document).ready(function(){
jQuery("input#save").click(function(){
//var ajaxurl = "<?php echo ( get_stylesheet_directory() . '/wp-content/themes/bb-theme-child/script.php' ); ?>";
jQuery.ajax({
type: 'POST',
url: '/wp-content/themes/bb-theme-child/assets/purge-bb-cache.php',
success: function(data) {
console.log("Purged BB Cache");
}
});
});
});
</script>
<?php
}
add_action('customize_controls_print_scripts', 'print_customizer_js');
Related Posts:
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- WordPress Ajax always returns a 404 error
- Click loads template via ajax
- Display notification only once
- Access/update database with jQuery
- How to speed up admin-ajax.php in wordpress
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Sending jsPDF documents to the server
- Ajax return code 400
- How to test nonce with AJAX – Plugin development
- class click counter save number
- AJAX request status 200 but no actual “response”
- Save Search System
- dynamic dependent select dropdown
- Menu jumping when calling it via PHP
- Setting value of session with Ajax not working
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Fancybox type popup window that’s not an iframe
- How do I Import / Upload Files with jQuery AJAX?
- WordPress Ajax Call inserting data but success response false
- Ajax search shows all results when user empties input?
- Why i can’t get custom fields value or post ID via Ajax?
- Accessing an API with jQuery and AJAX
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- How to use wp_ajax_set_post_thumbnail?
- Update $wpdb query with AJAX
- AJAX to add to cart multiple products woocommerce
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- number of posts with “Load More”
- Find the method which AJAX GET calls
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- 500 (Internal Server Error) of external php file
- Dynamic Gallery
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- notify users when changed database
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- How do I ensure that the URL parameters are updated correctly when multiple filters are applied
- Ajax contact form return 0
- AJAX – Returning Two JSON Objects with One PHP Function
- Pull GetOption() variable into jQuery dynamically created html
- admin-ajax Firing Error 400 When Logged In
- Error – ‘create_function is deprecated’ [closed]
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Unset session variable on page reload / setup but exclude AJAX
- Add Ajax Hooks and Call from Custom Template PHP
- Making an AJAX call to refresh a table
- HTML escaping data with ajax requests
- WordPress Ajax Always returning 0
- Is it save to use eval for a jQuery callback method coming from the database?
- Jquery window.send_to_editor function
- load ajax using admin-ajax.php
- wordpress add_action() issue in ajax call
- Function won’t run onclick using Ajax
- How to keep track of when a vote is cast?
- WordPress plugin admin page – using WordPress function in linked php file
- How to add drag and drop functionalities to a div inside option panel
- Load Posts on Click via Ajax into a DIV
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- Get related product based on subcategory selected from category id with ID 142
- A $_POST should occur when submit form but is not?
- My jQuery Ajax form submit is still refreshing page?
- jQuery Ajax PHP function call returning [object Object]
- Shortcode to pull posts
- Output votes to div dynamically in wordpress
- Get uploaded image and attach it to the new post
- Cannot access $wpdb, comes back NULL
- Admin-ajax php not working on new wordpress version
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Incrementing PHP variable onclick to display posts by month
- Proper way to use WordPress function with AJAX PHP file
- JS file is not loading when i put wp_head() and wp_footer
- Live search from database table
- Is there a hack for using is_page() within the function.php file?
- Add a counter for mouseovers (custom field)
- Set cookie for visitor
- Ajaxurl suddenly not defined
- Execute Jquery when a specific page in my plugin is loading
- Replacing WordPress Icons (menu,icons32, etc)?
- Covert WordPress Blogname into JQuery
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- what does $options = get_option(‘test_theme’); do?
- How to load previous or next attachment with jquery ?
- How to set variables with AJAX request to use in another function in WordPress
- Search Ajax Call – Use Form Data in Response
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Why does PHP called with Jquery AJAX not allow additional php code to be added?
- How to use wp_send_json() and output the value with ajax?
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Hot to check if new posts have been published since page load and notify online users?
- Customizer control save then return to default
- Display WordPress search results based on the selected Sub-Category
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- WordPress Search Ajax + Isotope + InfiniteScroll