Getting a variable using $post ajax back from php to js response in WP
You need to send the var through your ajax request: $.post( //be suer that this var is pointing to wp-admin/admin-ajax.php WPaAjax.ajaxurl, { action : ‘my_php_action_to_do’, //here your var and its value my_var : ‘the_value’ }, function( response ) { response = jQuery.parseJSON(response); alert(response.message); } ); In your my_php_action_to_do function: function my_php_action_to_do(){ $var[‘message’] = $_POST[‘my_var’]; //Send … Read more