开发者

How to use $.get method in asp.net mvc

I have this code in m开发者_如何学编程y view to hit one ActionResult

 ClearFilters = function () {
        $.get("/Mandate/Index/1");
        window.location.href = '<%=Request.Url.Scheme + "://" + Request.Url.Authority + Request.Url.AbsolutePath%>';
    }

My controller Method

Public ActionResult Index(int? id)
{
     //some code
}

with this Code I am able to hit Index Action Result but I am not getting int id value 1?

is that something I am doing wrong here?

Thanks


Try this. See if you get the id value, keeping all other code same.

$.get("/Mandate/Index", { id=1 }, success: function(){
   window.location.href = '<%=Request.Url.Scheme + "://" + Request.Url.Authority + Request.Url.AbsolutePath%>';   
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜