March 24, 201412 yr Heres the code first var options = { pageUrl: function(type, page, current){ return "portuguesegoods.com/theaquaponicist/gallery/index.php?type=blog&page="+page; } } What i need is for the is to get the url dynamically on each page where the code would be place But i only need portuguesegoods.com/theaquaponicist/gallery/index.php?type=blog; and not portuguesegoods.com/theaquaponicist/gallery/index.php?type=blog&page="+page; notes** The landing page or the page one will not have $_get variable so there will be no "+page on it but other pages will Note also the front link changes so it can be portuguesegoods.com/theaquaponicist/NEWS(***)/index.php?type=news&page="+page; or a who different domain how is this done? Thanks for your time Edited March 24, 201412 yr by sergRamalli
March 26, 201412 yr Hey! I think this is what you're looking for window.onload = getURL(); function getURL() { rawURL = window.location.href; if (rawURL.indexOf("&") != -1) slicedURL = rawURL.substring(0, rawURL.indexOf("&")); else slicedURL = rawURL; console.log(rawURL, " => ", slicedURL); } window.location.href gets the current URL and then the script verifies that it has a second parameter (i.e page). If there is a second parameter, the URL is trimmed, if not, only the raw URL is returned/ whatever. To implement this in your script copy everything but console.log(), and return slicedURL. Edited March 26, 201412 yr by jakdothtml
March 26, 201412 yr nice, you could simplify that to just .. slicedURL = window.location.split("&")[0];
March 26, 201412 yr nice, you could simplify that to just .. slicedURL = window.location.split("&")[0]; Haha, of course. I think I'd tried that first. Couldn't actually get it to work with window.location although window.location.href would work perfectly.
April 7, 201412 yr Author In the end i found a php solutions before i saw your reply. Which is a simple as a <?php echo $bah; ?> But i got a few ajax scripts where this will come in handy thanks
Create an account or sign in to comment