The below code will help others to achieve the above task.
<?php
add_action( 'wp_ajax_update_menu_order', 'update_menu_order' );
add_action( 'wp_ajax_nopriv_update_menu_order', 'update_menu_order' );
function update_menu_order() {
global $wpdb;
$table_name = $wpdb->prefix."posts";
$menu_order = $_POST['menu_order'];
$data = $_POST['post_id'];
$post_id = substr($data, strpos($data, "-") + 1);
$result = $wpdb->query($wpdb->prepare("UPDATE $table_name SET menu_order="$menu_order" WHERE ID=$post_id"));
echo $result;
wp_die(); // this is required to terminate immediately and return a proper response
}