Site icon Hip-Hop Website Design and Development

AJAX success response shouldn’t be working but it surely’s saving my adjustments

I am a newbie in jQuery-Ajax so please bear with me. My Ajax response doesn’t appear to load however my adjustments are being saved. however offers me this error on admin-ajax.php “call_user_func() expects parameter 1 to be a sound callback, perform ‘_update_post_ter_count’ not discovered or invalid perform title” Right here is my perform, may you level what i am doing improper?

add_action( 'wp_ajax_nopriv_save_sort', 'ccmanz_save_reorder' );
add_action('wp_ajax_save_sort','ccmanz_save_reorder');
perform ccmanz_save_reorder() { //checking

//confirm person intent
check_ajax_referer( 'wp-job-order', 'safety' ); // this comes from wp_localize_script() in hrm-jobs.php
//functionality test to make sure use caps
if ( ! current_user_can( 'manage_options' ) ) {
    wp_die( __( 'You shouldn't have permission to entry this web page.' ) );
}

$order   = explode( ',', $_POST['order'] );
$counter = 0;

foreach ( $order as $item_id ) {
    $submit = array(
        'ID'         => (int) $item_id,
        'menu_order' => $counter,
    );

    wp_update_post( $submit );
    $counter ++;
}
wp_send_json_success('POST SAVED');
}

My AJAX Name

jQuery(doc).prepared(perform($) {

sortList = $( 'ul#custom-type-list' ); //retailer
var animation = $ ( '#loading-animation' );
var pageTitle = $ ( 'div h2');

sortList.sortable({

replace: perform ( occasion, ui) {
    animation.present();

    $.ajax({
        url: ajaxurl, // ajaxurl is outlined by WordPress and factors to /wp-admin/admin-ajax.php
            sort: 'POST',
            async: true,
            cache: false,
            dataType: 'json',
            knowledge:{
                motion: 'save_sort', // Inform WordPress methods to deal with this ajax request
                order: sortList.sortable( 'toArray' ).toString(), // Passes ID's of listing objects in   1,3,2 format
                safety: WP_JOB_LISTING.safety
            },
        success: perform( response ) {
            animation.disguise();
            $('div.up to date').take away();
            if( true === response.success ) {
                console.log(sortList.sortable( 'toArray' ));
                pageTitle.after(  
                '<div id="messsage" class="up to date"><p>' + WP_JOB_LISTING.success + '</p></div>'
                );
            } else {
                $('div.error').take away();
                pageTitle.after( '<div id="messsage" class="error"><p>' + WP_JOB_LISTING.failure + '</div>' );
            }

        },
        error: perform ( error ) {
            $( 'div.error' ).take away();
            animation.disguise();
            //pageTitle.after( '<div id="messsage" class="error"><p>' + WP_JOB_LISTING.failure + '</div>' );
        }
    });

}//replace

   }); //sortable
});//jquery