MVC 中静态文件部分动态化
<div id="loginInfo"> @Ajax.ActionLink("Test", "LoginInfo", null, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "loginInfo", InsertionMode = InsertionMode.Replace }, new { id = "updatedLink" } ) </div> <script src="http://www.cnblogs.com/Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="http://www.cnblogs.com/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> <script src="http://www.cnblogs.com/Scripts/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="http://www.cnblogs.com/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#updatedLink").click(); }); </script>
原理:在HTML document在本地加载完成后,触发事件更新动态内容