AJAX Call returning 404(Local) in IIS 7.5 but same works in other IIS

后端 未结 4 2019
傲寒
傲寒 2021-01-31 10:39

Am having the AJAX calls to my controller in my MVC Application

Controller/FunctionName



$.ajax({
        type: \"GET\",
        contentType: \"application/jso         


        
4条回答
  •  我在风中等你
    2021-01-31 11:14

    Just a complement of Darin's answer that if "the AJAX call is in a separate javascript file where you cannot use server side helpers", use a hidden field to store the url endpoint in the view:

    @Html.Hidden("URLEndpointName", Url.Action("FunctionName", "Controller"))
    

    and read that hidden field in your js:

    url: $("#URLEndpointName").val(),
    

提交回复
热议问题