Quote:
var autocompleteUrl = '~/BookingManagement/AutoCompleteCustomer';
In JavaScript, that specifies a URL
relative to the current URL.
For example, if you were on:
https://yoursite/some-controller/some-action/
the JavaScript would try to load the autocomplete items from:
https://yoursite/some-controller/some-action/~/BookingManagement/AutoCompleteCustomer
If you want to specify an app-relative path within your view, you need to use the
Url.Content
helper:
var autocompleteUrl = '@Url.Content("~/BookingManagement/AutoCompleteCustomer")';
If it's an external
.js
file, you won't be able to use any HTML helpers, so you'll need to find an alternative approach.