Pavan
Pavan

Reputation: 1083

Call to the controller method through AJAX not working

I had asked this question before in this forum only. Ref: Link

I got help from many and problem was solved. But today I am facing the problem with ie8. I have hosted the app in IIS and I access it in other machine through LAN. Tested with chrome and firefox, it works fine. With ie8 also it was working, but now its not making controller call. Problem is Controller method is not getting called through ajax.

Can anybody pls help me with this?

Upvotes: 0

Views: 527

Answers (1)

Karthik Chintala
Karthik Chintala

Reputation: 5545

Yes, when you hosted your application on IIS it would not go to the Controller action because you are hardcoding the $.ajax url option.

This is your code:

url: 'ControllerName/MethodName'

The above url works fine when you run on your local machine, but it doesnot work on IIS.

You should always use @Url.Action("MethodName","ControllerName")

Under the hood, the Url.Action uses the routing API to generate the URL

Hope this helps

Upvotes: 1

Related Questions