Categories
CMS Mastering Development Wordpress

Update Woocommerce shipping cost when ajax request is made

I have google autocomplete api on my address field in checkout page and embeded map with polygons as delivery zones. Each zone has it’s own delivery cost which also depends on order’s total cost. When address is entered, js function is triggered to check if address is inside of any of the polygons and it […]

Categories
CMS Mastering Development Wordpress

Styles and scripts not loading when wordpress is uploaded

My custom theme works well on my localhost, but when I upload it to my domain, it can not enqueue any of my styles and javascript. I have everything done correctly. wp_head & wp_footer installed, wp_enqueue_script & wp_enqueue_style defined for each element. Functions.php function load_stylesheets() { wp_register_style(‘bootstrap’, ‘https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css’); wp_enqueue_style(‘bootstrap’); wp_register_style(‘font’, get_template_directory_uri().’/css/font-awesome.min.css’, array(), 1, ‘all’); wp_enqueue_style(‘font’); […]

Categories
CMS Development Wordpress

wp-admin/admin-ajax.php 400 (Bad Request) plugin

There is a strange and frustrating behavior of the wordpress file admin-ajax.php, when I make an ajax request, it returns an incorrect 404 error request. function rp_add_header() { if (is_single() || is_page()) { // include the jquery Ajax/form validation javascript file wp_enqueue_script( ‘ajax-script’, plugin_dir_url(__FILE__).’rp-script.js’, array(‘jquery’), 1.0 ); // jQuery will be included automatically // create […]

Categories
CMS Development Wordpress

Ajax in plugin fails – but only on one blog – no idea why

this seems hard to understand. I created a plugin, and it works fine on different installations of me and a few other blogs. But on one blog of someone else it fails. After getting through debugs and console entries, I believe I found the source of the failure: At some step of the process the […]

Categories
CMS Development Wordpress

400 Bad Request, in wordpress theme development, wp_ajax

As Salamu Alaikum, I am developing a theme and I have tried every way of getting a successful ajax request and it is still showing me the 400 bad request error. And there is no solution I found going through one after one question in StackOverflow and WordPress StackExchange. Here is the ping.js file from […]

Categories
CMS Development Wordpress

ajax_object is not defined when ajax call the funtion

When i call function in php using ajax i get Uncaught (in promise) ReferenceError: ajax_object is not defined html2canvas(document.getElementById(“primary”)).then(function(canvas) { console.log(“image_base64: “, canvas); var data = { ‘action’: ‘bingogames_canvas_save’, ‘play_id’: play_id, ‘image_base64’: canvas.toDataURL() }; jQuery.post(ajax_object.ajax_url, data, function(response) { console.log(‘Got this from the server: ‘, response); }); }); My jquery function is in template file an […]