title: MVC AJAX call url format
body: <p>I am working on a small MVC 5 application which has a handful of views and javascript files.</p>
  
  <p>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. <code>http://host/application/</code>.</p>
  
  <p>The issue is caused by the url parameter of the jquery ajax call not resolving consistently. For example, one script is happy with:</p>
  
  <pre><code>$.ajax({ url: 'controller/action' ....});
  </code></pre>
  
  <p>while another requires</p>
  
  <pre><code>$.ajax({url: '../controller/action' ....});
  </code></pre>
  
  <p>and most recently another requires</p>
  
  <pre><code>$.ajax({url: '../action' ....});
  </code></pre>
  
  <p>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?</p>
  
  <p>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.</p>