In my Project i need to pass value partial value while click button. So i tried like this
<div id="searchgrid" class="col-lg-12">
@Html.Partial("ResultGrid", new List<SCM_MVC.Models.User>(),
new ViewDataDictionary(this.ViewData) { { "index" , xEdit } })
</div>
<script src="~/assets/js/jquery-1.10.2.js"></script>
<script>
var url = '@Url.Action("ResultGrid", "User")', new { xEdit : ViewData["Form"] };
$('#btnloadgrid').click(function () {
$('#searchgrid').load(url);
})
</script>
While open View its Working. But Click button its not working. What am doing wrong in jquery function?
var url = '@Url.Action("ResultGrid", "User")', new { xEdit : ViewData["Form"] };will create an invalid output in the JS. If you check the actual rendered code (and the console) you'll see the syntax issues.ViewData["Form"]? That would only work if its a simple value (and thenew { .. }would need to be withing theUrl.Action())