How do I AJAX post to an MVC action from within a javascript file? <p>The following code exists in a file called <em>job.js</em>. When I run this code against localhost everything behaves properly. When I do so against my intranet server where there is an application name I get a 404. </p> <pre><code>Job.updateJob = function () { $.post('/Builder/ListJobItems', function (data) { ... }); } </code></pre> <p>I would love to use <code>@Url.Action()</code> but as I said this is javascript (.js) file. I am also aware of the hack where you put a data value onto the body element, but for architectural reasons, I want this code to be decoupled from the DOM. It is a data acquisition engine, why should it even know what a DOM is.</p> <p>I would be fine with a solution that parses <code>window.location</code> in some fashion, but the problem that I am having their is that I need a solution that will work everywhere.</p> <p>What frustrates me most is that I can't see how this isn't a problem everyone would face. Why isn't there a solution? Does everyone just put all of their JavaScript into the razor view? Does no one isolate code into modules anymore? I can't believe either of these is true, and yet there don't seem to be any forth coming solutions for this. I am at a loss.</p>