Skip to main content
deleted 43 characters in body
Source Link
tam
  • 109
  • 5

It seems there is a problem with at url: "/wp-admin/admin-ajax.php", instead try adding the full path:

function addajaxurl() {
    wp_localize_script( 'frontend-ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
}
add_action( 'wp_enqueue_scripts', 'addajaxurl' );

and call the variable in your ajax function:

        jQuery.ajax({
            type:"POST",
            action: "my_test_action",
            url: ajaxurl,
            data: newFormChange,
            success:function(data){
                console.log(data);
            }
        }); 

It seems there is a problem with at url: "/wp-admin/admin-ajax.php", instead try adding the full path:

function addajaxurl() {
    wp_localize_script( 'frontend-ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
}
add_action( 'wp_enqueue_scripts', 'addajaxurl' );

and call the variable in your ajax function:

        jQuery.ajax({
            type:"POST",
            action: "my_test_action",
            url: ajaxurl,
            data: newFormChange,
            success:function(data){
                console.log(data);
            }
        }); 

It seems there is a problem with at url: "/wp-admin/admin-ajax.php", instead try adding the full path:

function addajaxurl() {
    wp_localize_script( 'frontend-ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
}
add_action( 'wp_enqueue_scripts', 'addajaxurl' );

and call the variable in your ajax function:

        jQuery.ajax({
            type:"POST",
            url: ajaxurl,
            data: newFormChange,
            success:function(data){
                console.log(data);
            }
        }); 
Source Link
tam
  • 109
  • 5

It seems there is a problem with at url: "/wp-admin/admin-ajax.php", instead try adding the full path:

function addajaxurl() {
    wp_localize_script( 'frontend-ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
}
add_action( 'wp_enqueue_scripts', 'addajaxurl' );

and call the variable in your ajax function:

        jQuery.ajax({
            type:"POST",
            action: "my_test_action",
            url: ajaxurl,
            data: newFormChange,
            success:function(data){
                console.log(data);
            }
        });