Been trying to run jQuery functions based on a dynamic url but having some issues.
Say my HTML file is called myPage.html
This is the code I am using to check the URL
var pathname = window.location.pathname;
var splitPath = pathname.split("?");
var input = splitPath[splitPath.length-1];
console.log(pathname);
I am looking at the file locally, and when I put it in the browser /pathname/myPage.html my console outputs /pathname/myPage.html exactly what I was expecting.
But now, if I change the url to /pathname/myPage.html?input=yes the page loads fine, but the console still only logs /pathname/myPage.html meanwhile I would like to see input=yes
What am I doing wrong here?
window.location.search?