发布后无法加载资源 jquery 函数

Failed to load resource jquery function after published

在 Visual Studio 2012 年,我使用的是 MVC 4 和 C#。我有三个 dropdownlist。每个都基于另一个绑定并与之相关,并且工作正常,但是在我发布之后,它没有工作,因为我有一个 jquery 函数来从 jsonresult 读取数据并且它不允许访问到函数 options.url = "/invoice/GETCompanyByID";.

if ($("#Area").val() != "Please select") {
    var options = {};
    options.url = "/invoice/GETCompanyByID";
    options.type = "POST";   
    options.data = JSON.stringify({ stateid: $("#Area").val() });     
    options.dataType = "json";
    options.contentType = "application/json";
    options.success = function (states) { 
        $("#state").empty();
        $("#inv").empty();
        for (var i = 0; i <= states.length; i++)
        {                         
            $("#state").append("<option selected value=" + states[i].Value + ">" + states[i].Text + "</option>")
            $("#contract").val($("#state").val())
            $("#state").prop("disabled", false);
        }
    };
    options.error = function () { alert("Error retrieving states!"); };
    $.ajax(options);
}
else {
    $("#state").empty();
    $("#state").prop("disabled", true);
}

$("#areaid").val($("#Area").val())
});

[HttpPost]
public JsonResult GETCompanyByID(int stateid)
{
    return Json(new SelectList(DAL.Get_All_Contract(stateid), "IDContract", "ContractNo"));
}

最后我解决了来自

的错误
options.url = "/invoice/GETCompanyByID"; 

而我应该使用

Url.content("~/invoice/GETCompanyByID")