How can the 'action' parameter be used in WordPress AJAX plugin development?

When developing a WordPress AJAX plugin, the 'action' parameter is used to specify the specific AJAX action being performed. This parameter helps differentiate between different AJAX requests and ensures that the appropriate callback function is executed. To use the 'action' parameter, it should be included in the data sent in the AJAX request and then checked in the PHP callback function to determine the action to be taken.

// Enqueue jQuery and custom AJAX script
function enqueue_custom_script() {
    wp_enqueue_script('custom-ajax-script', plugin_dir_url(__FILE__) . 'js/custom-ajax-script.js', array('jquery'), '1.0', true);
    wp_localize_script('custom-ajax-script', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
}
add_action('wp_enqueue_scripts', 'enqueue_custom_script');

// AJAX callback function
function custom_ajax_callback() {
    if(isset($_POST['action']) && $_POST['action'] == 'custom_action') {
        // Perform actions specific to 'custom_action'
    }
    wp_die();
}
add_action('wp_ajax_custom_action', 'custom_ajax_callback');
add_action('wp_ajax_nopriv_custom_action', 'custom_ajax_callback');