WordPress Ajax JSON success return no being recognized

You are not giving the action name to your AJAX call. In WordPress, you have to give an action name, the same name you give whatever is after wp_ajax_ and wp_ajax_nopriv_ In this case, the AJAX call should work if you change the data: inside your AJAX call, for this: data: {action: “contactform_action”, values: $(‘#contact-form’).serialize()} … Read more

AJAX Post from same domain to a wordpress page

First, WordPress has a built-in way to handle AJAX requests, you should read this page and use that method instead. The issue with your method is that you’re POSTing the name var. name is a WordPress query var, and is causing WordPress to query for a page with slug John. Always prefix your vars with … Read more

Deploy Subcategories with Ajax not working

onclick=”cat_ajax_get(…)” looks for a function in the global Javascript scope. This line: jQuery(document).ready(function($){ hides everything from the global scope. So, this won’t work. You will have to use a completely different technique here. Do not set the onclick attribute. Instead attach the handler from inside your Javascript code: jQuery(document).ready(function($){ var links = $(“.filter a.ajax”); var … Read more

Ajax Function call is always returning 0 in front end(without plugin) [closed]

First things first You have a few errors in your code. The table for terms is called wp_terms instead of wp-terms The query $qry is not correct, the inner query has an invalid WHERE-clause: SELECT term_id as term_id FROM wp_term_taxanomy = ‘category’ should be SELECT term_id as term_id FROM wp_term_taxanomy WHERE taxonomy = ‘category’ Improvement: … Read more

Use ajax without a plugin?

Plugin code is just… code, it can go in a themes functions.php, or a plugin file, there’s no magical or special difference other than the order they’re loaded in, and the API calls are identical, work the same way etc because they’re the same. It’s just how the code is packaged For example, if you … Read more

AJAX call in backend results in empty update_option

I figured it out, when registering with register_setting the second parameter is the name of the settings you will be saving and updating, the parameter is pass in here to whitelist it against being updated outside of the plugin. The AJAX callback is deemed outside of the plugin. My register settings is below and the … Read more