title: How do I get jQuery ajax url prefixes to resolve controller action methods?
body: <p>I'm sure this question has been asked multiple times, but the one example of the problem I'm having was <a href="https://stackoverflow.com/questions/3737094/how-do-i-get-the-correct-url-for-an-mvc-action-when-using-jquery-ajax">asked about here.</a></p>
  
  <p>Basically, if I have an ajax call to <code>/Controller/Action</code>, it works fine if I'm using my local development server of <code>localhost/Controller/Action</code>.</p>
  
  <p>If I publish to UAT, the url needs more information. It's now <code>server/application/Controller/action</code>, which obviously breaks my ajax call.</p>
  
  <p><code>&lt;%: Url.Action("MyAction") %&gt;</code> solves this, but doesn't exist in the context of a seperate javascript file.</p>
  
  <p>Currently, I have a javascript variable 'urlPrefix' in my app.js file, which I have to change between <code>""</code>and <code>"applicationName"</code> everytime I debug locally or release to a different server.</p>
  
  <p>What's the easiest way of solving this? </p>