Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
45785 Points
7698 Posts
MVP
Dec 11, 2011 09:46 AM|LINK
Do this,
Home View
@{ if (Request.IsAjaxRequest()) { Layout = null; } ViewBag.Title = "Home"; } @if (!Request.IsAjaxRequest()) { <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script> } <script type="text/javascript"> function myCallback(xhr, status) { alert(status); } </script> <div id="divLoading" style="display: none"> Loading ...</div> <div id="divResultText"> @Ajax.ActionLink("Edit Ajax", "Index", "Edit", null, new AjaxOptions { HttpMethod = "Get", OnComplete = "myCallback", UpdateTargetId = "divResultText", LoadingElementId = "divLoading" }) </div>
Edit View
@{ ViewBag.Title = "Edit"; if (Request.IsAjaxRequest()) { Layout = null; } } @Ajax.ActionLink("Home", "Index", "Home", null, new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "divResultText", LoadingElementId = "divLoading" })
imran_ku07
All-Star
45785 Points
7698 Posts
MVP
Re: Ajax.ActionLink in MVC3 is getting slow after a number of requests
Dec 11, 2011 09:46 AM|LINK
Do this,
Home View
@{ if (Request.IsAjaxRequest()) { Layout = null; } ViewBag.Title = "Home"; } @if (!Request.IsAjaxRequest()) { <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script> } <script type="text/javascript"> function myCallback(xhr, status) { alert(status); } </script> <div id="divLoading" style="display: none"> Loading ...</div> <div id="divResultText"> @Ajax.ActionLink("Edit Ajax", "Index", "Edit", null, new AjaxOptions { HttpMethod = "Get", OnComplete = "myCallback", UpdateTargetId = "divResultText", LoadingElementId = "divLoading" }) </div>Edit View
@{ ViewBag.Title = "Edit"; if (Request.IsAjaxRequest()) { Layout = null; } } @Ajax.ActionLink("Home", "Index", "Home", null, new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "divResultText", LoadingElementId = "divLoading" })Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD