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%>';
});
精彩评论