Nov 6, 2018

JavaScript - How to get request url parts (segments)

 Extracting url parts:

var urlParts = window.location.pathname.split('/');
var lastSegment = urlParts.pop() || urlParts.pop();

window.location.href = window.location.pathname.replace(lastSegment, myQueryPath);