WooCommerce: Translation lost on AJAX call in Checkout page [closed]

I think I fixed the issue with the following extended function in my plugin: function localize_backend( $locale ) { // set langauge if user is in admin area if( defined( ‘WP_ADMIN’ ) || ( isset( $_REQUEST[‘pwd’] ) && isset( $_REQUEST[‘kau-boys_backend_localization_language’] ) ) ){ // ajax call from frontend if ( ‘admin-ajax.php’ == basename( $_SERVER[ ‘SCRIPT_FILENAME’ … Read more

WordPress Ajax Getting Response “Null”

You are rendering the json data the wrong way. Change the success to the below:– success: function(data) { alert(data.id); // Now you can similarly render the other details like details.success }

Prevent page reload after ajax form submission

To solve this, you need to unbind the event that triggers the second AJAX request. You need to make sure that your unbind() function is called after the event binding has occurred. So why not just load it in the footer? One reason is that the other script that binds the event might be loading … Read more

How to localized one js file for different actions?

Maybe I got your question wrong. I don’t get what you mean by: If I don’t do the localize, I can’t get response. But in general, this function lets you localize your JS strings, but you can also use it to set JS variables: function set_my_js_var() { // logic here for setting the right JS … Read more

Buddypress ajax problem after adding new groups sub nav [closed]

Is i commented previously im having the same error. I dont know what it causing it but i found a workaround for it. Im using a modified version (by me) of the plugin buddypress-groups-tags which allows me to create categories for groups. That plugin uses bp_core_new_subnav_item to be able to use slugs like : http://local.dev/groups/category/teachers/ … Read more

Is it safe to use $_POST directly in my plugin instead of using admin-ajax.php to receive data from ajax?

First, everyone doesn’t say that. Everyone says to use admin-ajax.php for ajax, which is it’s meant for, not form submissions precisely. It’s not as popular and well covered, but there is actually different endpoint for form submission — admin-post.php. The reasons are, however, same. What you cannot do in your plugin is reliably load WordPress … Read more

WP_Session not acting with AJAX

I think in your code you must add this line for ajax acting jQuery.ajax({ type : ‘POST’, url : ‘<?php echo admin_url(‘admin-ajax.php’); ?>’, data : { action : ‘vg_show_post_id’, post_id: $post_id, data-id: true }, ),