• Resolved viter-z-bayraku

    (@viter-z-bayraku)


    My code is:

    jQuery.ajax({
    url: "<?php echo admin_url('admin-ajax.php'); ?>",
    type: 'POST',
    data: {
    action: 'stravyfuncajax'
    },
    dataType: 'html',
    success: function(response) {						alert(response);
    }
    add_action('wp_ajax_stravyfuncajax', 'testfunc11');
    add_action('wp_ajax_nopriv_stravyfuncajax', 'testfunc11');
    
    function testfunc11() {
    echo "2";
    die();
    }

    Please help. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • hi

    did u debug it ?
    i’ve the same problem here …

    thanks

    Thread Starter viter-z-bayraku

    (@viter-z-bayraku)

    I dont remember how i fixed it, but now this code are working.

    jQuery(document).ready(function(){
    		jQuery("#testbutton").click(function(){
    			 jQuery.ajax({
    				url: "<?php echo admin_url('admin-ajax.php'); ?>",
    				type: 'POST',
    				data: {
    				action: 'stravyfuncajax22'
    				},
    				dataType: 'html',
    				success: function(response) {
    				alert(response);
    				}
    			});
    		});	
    
    	});

    and code:

    add_action('wp_ajax_stravyfuncajax22', 'testfunc11');
    add_action('wp_ajax_nopriv_stravyfuncajax22', 'testfunc11');
    
    function testfunc11() {
    echo "2";
    die();
    }

    Hi Viter,

    Thanks veru much, i’ll try it

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin ajax call to wp-ajax.php in admin page returning 0’ is closed to new replies.