I have some jQuery where I'm loading HTML into a document using a .get, like this:
var url = '@Url.Action("beneficiary")';
$.get(url, function (response) {
$('#beneficiaries').append(response);
});
It works perfectly when the script is inline, but when I move it to an external .js file, the .get fails and I get an HTTP 404 error. (File not found: http ... /Wizard/@Url.Action("beneficiary")).
The external .js file is WizardScript.js, I'm including it like this (I'm using jQuery UI elsewhere in the script, hence those script tags):
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="~/Scripts/WizardScript.js"></script>
This was working earlier, and I have no idea what happened! Any ideas?