last day (14 days later) » 

12:31 AM
0
Q: Getting previous page URL instead of current page

arcadeRobI am trying to get the current page URL and parameters but JavaScript and jQuery are returning the previous page's URL. I am currently using: $(document).ready(function() { function getUrlParameter(sParam){ var sPageURL = window.location.search.substring(1); ...

 
Can you be more specific on how to reproduce the problem?
 
@Ludovic have a hyperlink on the previous page the previous page that has it's href generated by a for loop and inserted as an attribute by jQuery. when I click the link i am taken to the page that has the code listed here but it gets the href from the previous page for some reason.
 
Ok i see, i'm trying to reproduce your problem with two page linked with each other, can you post some more code to show how you set your URL?
 
@Ludovic I added some code
 
I don't think the problem come from your previous page. What is on your current page before your JQuery code?
 
12:31 AM
@Ludovic Also, the URL in the browser is correct but the output in the console is undefined. If I output the URL itself it comes out as the URL from the previous page
 
don't you override the URL previously on your code? something like window.location.href="previousPage.html"
will be easier here ^^
can you post your code on jsfiddle.net ?
 
i've never done it before. lol
 
the chat? me too :) first time
 
i can show you the HTML page that I am using:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Profile</title>

<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.css" />
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/jquery.mobile-1.4.5.js"></script>
<script src="js/ipVar.js"></script>
 
can you post on jsfiddle?
 
12:33 AM
chat and jsfiddle
i havent posted on it before
 
yeah i discovered it few week ago too :) very good tool
 
im looking at it now
its a strange problem. i cant figure it out on jsfiddle. i will keep looking for an answer and post it if i find it. thanks for trying
 
i can keep looking with you if you want, you can share your code with me, just click save and give me the link :)
 

last day (14 days later) »