关于JS中返回上一级

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_37817251/article/details/79357715

返回上一级,有两种情况,第一:刷新上一个页面;第二:不刷新上一个页面。

首先是,刷新上一个页面,不保留上一个页面的任何操作;(1)<a href="JavaScript:history.go(-1)">返回上一级</a>;(2)使用require进行操作。代码如下:// returnLeve.js是返回上一级的js,
// returnLeve是使用require进行封装的一个模块
function returnLeveFun(){
require(['returnLeve'],function(ReturnLeve){
var returnLeve = new ReturnLeve();
$("#thisContent").empty();
$("#thisContent").html(returnLeve.content);
});

}

(3)使用$.get('demo.html',function(data){

 var html = data;

this.content(html)

});

第二个:不刷新上一个页面,window.location.href=document.referrer;

猜你喜欢

转载自blog.csdn.net/weixin_37817251/article/details/79357715
今日推荐