开发者

JQGrid URL Sometimes including controller in call

开发者 https://www.devze.com 2022-12-12 19:51 出处:网络
So I have this code in a javascript function in my ASP.NET MVC application... jQuery(\"#SomeResultsGrid\").jqGrid({

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消