laravel use route in javascript file code example
Example 1: call laravel route js
function confirmDelete(id){
let url = "{{ route('getDeleteRequest', ':id') }}";
url = url.replace(':id', id);
document.location.href=url;
}
Example 2: hti laravel route from javascript file
<script type="text/javascript">
var deletePostUri = "{{ route('delete_post',$post_id)}}";
</script>