Meine Ajax-Aufruf Ausgang rufen immer 0 als Ausgang zeigt nicht wissen, warumWie Ajax in Wordpress
In functions.php
ich diesen Code haben
function get_data() {
$abc = '1';
$result = $wpdb->get_results("SELECT * FROM ".$wpdb->options ." WHERE option_name LIKE '_transient_%'");
echo $result; //returning this value but still shows 0
wp_die();
}
add_action('wp_ajax_nopriv_get_data', 'get_data');
add_action('wp_ajax_get_data', 'get_data');
Und Anruf meine Ajax in ein Javascript
ist$('body').on("click", ".re-reset-btn", function(e){
var panel = $('#re-compare-bar');
$.ajax({
type : "GET",
dataType : "json",
url : "/wp-admin/admin-ajax.php",
data : {action: "get_data"},
success: function(response) {
alert("Your vote could not be added");
alert(response);
}
});
$("#re-compare-bar-tabs div").remove();
$('.re-compare-icon-toggle .re-compare-notice').text(0);
});
ich mache ajax-Aufruf in Wordpress ohne Plugin Einsatz aber nicht bekommen, was ich passing.Even bin Wenn ich Ausgang $ abc noch zeigt es 0
Es sagt mein_ajax_object ist nicht definiert – smarttechy
wp_local_script bitte ersetzen Sie dies als wp_localize_script jetzt habe ich den Code geändert –