Skip to content

Instantly share code, notes, and snippets.

@xto3na
Last active October 27, 2015 14:43
Show Gist options
  • Save xto3na/32b5b1bac1876464b21d to your computer and use it in GitHub Desktop.
Save xto3na/32b5b1bac1876464b21d to your computer and use it in GitHub Desktop.
Edit location
$('#button-filter').on('click', function(bf) {
var stepCount = 2;
var currentUrl = window.location;
var firstAddr = currentUrl.pathname.toString().match(/^\/[a-z]*\/?/);
window.location = location.protocol + "//" + location.hostname + firstAddr[0] + location.search;
//window.history.go( - stepCount);
bf.stopImmediatePropagation();
});
//OR
$('#button-filter').on('click', function(bf) {
var currentUrl = window.location;
var firstAddr = currentUrl.pathname.toString().match(/^\/[a-z\-]*\/?/);
// var newSearch = currentUrl.search.toString().match(/\?route\=[a-z]*\/[a-z\-]*\&path\=[0-9\_]*/);
window.location = location.protocol + "//" + location.hostname + firstAddr[0];// + location.search;//newSearch[0];
//window.history.go( - lenItems);
bf.stopImmediatePropagation();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment