After clicking on an article link in my first html page, the URL of the second page looks like this:


In JS, I'm trying to get the url=... and do something with it. Here's what I have for the scripts:


<div data-role="page" id="newstext">
<div data-role="content">
<div id="textcontent"></div>
<script src="js/newstext.js"></script>


$('#newstext').bind('pageshow', function(event) {
var url = getUrlVars()["url"];
alert (url);

function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
return vars;

If you need to see my first page along with js and php file, let me know. Strange thing is I had it working before and now...I don't know what happened. I tried placing the script between the head tags, doesn't work. What's wrong here?