So I have this code in a javascript function in my ASP.NET MVC application...
jQuery("#SomeResultsGrid").jqGrid({
url: 'SomeSearch.mvc/SomeSearchResultsGridEventHandler', ...
This loads on my default page and raises just fine (fiddler confirmed). Now, if I go to that default page (via a Html.ActionL开发者_如何转开发ink), the url that posts after load now looks like SomeSearch.mvc/SomeSearch.mvc/SomeSearchResultsGridEventHandler. Anyone know why and how I can resolve it?
You're using a relative URI, so the URI will be treated as relative to the current location. You can put a /
at the start like this to make it an absolute path:
jQuery("#SomeResultsGrid").jqGrid({
url: '/SomeSearch.mvc/SomeSearchResultsGridEventHandler', ...
Problem is, now it won't work in a virtual folder. We handle that with a JS routine which knows about the site root using info in the Site.Master.
精彩评论