I am working on a small MVC 5 application which has a handful of views and javascript files.
The project structure is pretty standard, i.e. the normal layout for Controllers, Views, Scripts etc but I'm having problems the the AJAX calls within the scripts when I deploy to the client system - where the application is deployed within a Virtual Directory, e.g. http://host/application/.
The issue is caused by the url parameter of the jquery ajax call not resolving consistently. For example, one script is happy with:
$.ajax({ url: 'controller/action' ....});
while another requires
$.ajax({url: '../controller/action' ....});
and most recently another requires
$.ajax({url: '../action' ....});
I can't see that I've done anything differently for these scripts (or controllers or views) so why are the urls being generated differently?
I can work around this for now but want to understand the cause of the problem so i don't get in a mess later.