开发者

jqGrid call ASP.NET MVC controller action lost web application name

I got an issue when using jgGrid from IIS 6. My javascript looks like:

jQuery("#sandgrid").jqGrid({
    url: '/Deposit/Search?startDate=' + startDate + '&endDate=' + endDate,
    datatype: 'json',
    .....

It runs fine on my local using development web server. But when I deploy to IIS. It failed to retrieve the data, because it sent the request as http://xxx.xxx.xxx.xxx/deposit/search?... instead of http://xxx.xxx.xxx.xxx/appName/deposit/search?...

Could anybody tell me how to make i开发者_运维问答t correct? BTW, I set up "Wildcard mapping" on IIS 6 to run ASP.NET MVC.

Thanks!


Use this code instead:

jQuery("#sandgrid").jqGrid({
    url: '<%= Url.Action("Search", "Deposit") %>?startDate=' + startDate + '&endDate=' + endDate,
    datatype: 'json',
    .....

Url.Action() method automatically adds the virtual directory path into the URL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜