January 27, 2017

Failed to call controller method using AJAX in MVC 4 when deployed in IIS Server

Have you ever faced this issue in ASP.NET MVC? I found this issue after deploying my MVC application in IIS server, I shocked as it was working fine in local system but in hosting server it was not. Tried to search solution over the net but non of the solution worked for me. Finally I changed the URL verb and it was resolved. The detail of error is given below, hope it will be useful for someone.


Failed to load data..{"readyState":4,"responseText":....some HTML tag..\r\n \r\n The resource cannot be found.\r\n \r\n


Solution is pretty simple, use "../" in your SRC instead of "~" symbol.

Updated on https://www.codeproject.com/Answers/790566/Failed-to-call-controller-method-using-AJAX-in-MVC?cmt=914340