Convert this relative path to absolute

As long as your wp-admin directory is still at the root of your site, you can just add a forward slash (/) to the URI. Alterntaively, you can use wp_localize_script() to pass in your site’s URL or, if you are using WordPress’s AJAX functions, the ajaxurl JS variable.

var ajaxPath="/wp-admin/admin-ajax.php";

Or

<?php
wp_enqueue_script( 'some_handle' );
$translation_array = array( 'ajaxPath' => admin_url( 'admin-ajax.php' ) );
wp_localize_script( 'some_handle', 'object_name', $translation_array );
?>