• Resolved mmw109

    (@mmw109)


    Hi I’m trying to use your code snippets to add a WordPress Ajax action, and it just gets 400. I’ve tried various differet JavaScript syntaxes for this and proven that the WordPress action is registered (via do_action). The URL is also correct.

    PHP Code block (using CJ Toolbox)

    
    function my_action() {
            echo "no bananas";
    	wp_die(); 
    }
    
    // AJAX handling to get javascript returns
    add_action( 'wp_ajax_my_action', 'my_action' );
    add_action( 'wp_ajax_nopriv_my_action', 'my_actionX' );
    
    
    Javascript call
    

    var data = {
    action: ‘my_action’,
    whatever: 1234
    };

    // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
    jQuery.post(ajaxmw, data, function(response) {
    alert(‘Got this from the server: ‘ + response);
    });
    `

    Chrome Says : https://www.MYDOMAIN.co.uk/wp-admin/admin-ajax.php 400

    Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Author wipeoutmedia

    (@wipeoutmedia)

    Hi there,
    Thanks for your support question.
    We will try to reproduce this issue and see what we learn. We’ll post the findings back in due course.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding Ajax Action – 400’ is closed to new replies.