Fix double loading bug
On an html load, the page was reload by the js "popstate"
This commit is contained in:
		
							parent
							
								
									77842ab37d
								
							
						
					
					
						commit
						69a8fce64a
					
				| 
						 | 
				
			
			@ -3,6 +3,7 @@ $(function () {
 | 
			
		|||
    function () {  
 | 
			
		||||
      $.getScript(this.href);
 | 
			
		||||
			history.pushState(null, document.title, this.href);
 | 
			
		||||
			history_edited = true;
 | 
			
		||||
      return false;
 | 
			
		||||
    }  
 | 
			
		||||
  );
 | 
			
		||||
| 
						 | 
				
			
			@ -11,16 +12,20 @@ $(function () {
 | 
			
		|||
    function () { 
 | 
			
		||||
      $.getScript(this.href);
 | 
			
		||||
			history.replaceState(null, document.title, this.href);
 | 
			
		||||
			history_edited = true;
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
	$('.form').live('submit', function () { 
 | 
			
		||||
    $.post(this.action, $(this).serialize(), null, 'script');
 | 
			
		||||
		history_edited = true;
 | 
			
		||||
    return false;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
	$(window).bind("popstate", function () { 
 | 
			
		||||
		if (history_edited) { 
 | 
			
		||||
    	$.getScript(location.href);  
 | 
			
		||||
		}
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
		Loading…
	
		Reference in New Issue