自己做的一个实验,留作备忘,此实例包括扩一下几个文件: 1.MyMovieController.cs 2.Index.aspx 3.ViewUserControl1.ascx 4.movie类 其中MyMovieController.cs不用再说了,代码如下 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.
最近研究pushState,看了网上的文章还是不怎么会用,于是自己摸索着理解使用,终于实现局部刷新同时前进后退. 首先说说pushState(),这个函数将当前的url等信息加入history堆栈中: 当点击浏览器的前进后退按钮时,会触发popstate事件,所以可以在onpopstate的时候使用ajax实现局部刷新前进后退. 我的方法(用jQuery): 1.定义两个函数 function ajaxLoad(){ //里面加载ajax }; function setState(){ var