back knopf

This commit is contained in:
Martin Müller 2014-04-30 17:17:15 +02:00
parent ee84a67d87
commit 8a16b15d29
1 changed files with 11 additions and 1 deletions

View File

@ -10,6 +10,13 @@
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading"); }
});
$(window).bind('popstate',function(evt){
console.log(evt.target.pageurl);
console.log(evt);
if(evt.originalEvent.state !== null) {
load(location.href,{'history':false},false);
}
});
$("#popup").modal({'remote':false,'show':false});
$("#popup").on('show.bs.modal',function(e){
$.ajax({url:$(e.relatedTarget).attr("href"),success:function(data){
@ -174,19 +181,22 @@
data = {};
typemethode = "GET";
back = false;
history = true;
if(conf['data'])
data = conf['data'];
if(conf['type'])
typemethode = conf['type'];
if(conf['back'] && conf['back'].indexOf("logout")== -1 && conf['back'].indexOf("login")== -1 )
back = conf['back'];
if(conf['history'])
history = conf['history'];
//e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
$.ajax({url:pageurl,data:data,type:typemethode,success:function(data){setContent(data,back,tab);} ,error:function(data){setContentError(data,back,tab);}});
if(pageurl!=window.location){
if(history && pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
};