i tryed to return a number of Values from an Ajax Name,
I might Wish to retun Worth a and worth b in two separat Variables in my Ajax perform.
Is it posible to try this? or may I take advantage of an Array? Or ought to i do for each Name a personal Perform?
My Perform: “right here i’ll do one ore extra Database querys”
perform rob_ajax_vorlage() {
international $wpdb;
$a = "100";
echo $a;
$b = "200"; //second worth that doesen work jet
echo $b; //second worth that doesen work jet
wp_die(); // simply to be protected
}
add_action( 'wp_ajax_rob_ajax_vorlage_approal_action', 'rob_ajax_vorlage' );
add_action( 'wp_ajax_nopriv_rob_ajax_vorlage_approal_action', 'rob_ajax_vorlage' );
And my Ajax name
jQuery(doc).prepared(perform($) {
$( '#rob-wp-ajax-vorlage-button' ).click on( perform() {
var abc = $( '#abc' ).val();
$.ajax({
technique: "POST",
url: ajaxurl,
information: { 'motion': 'rob_ajax_vorlage_approal_action', 'abc': abc, }
})
.carried out(perform( information ) {
console.log('Profitable AJAX Name! /// Return Information: ' + information);
.fail(perform( information ) {
console.log('Failed AJAX Name :( /// Return Information: ' + information);
});
});
});
Im A Newbie so sorry if i requested one thing loopy.
so it might be grade if somebody may assist me to make use of return two values.
Thanks
Rob