javascript - url parameter not alerting out in jQuery Mobile script -
after clicking on article link in first html page, url of second page looks this:
localhost/basket/newstext.html?url=http://www.basket-planet.com/ru/news/9235
in js, i'm trying url=... , it. here's have scripts:
page2.html:
<body> <div data-role="page" id="newstext"> <div data-role="content"> <div id="textcontent"></div> </div> </div> <script src="js/newstext.js"></script> </body>
newstext.js:
$('#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 = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }
if need see first page along js , php file, let me know. strange thing had working before , now...i don't know happened. tried placing script between head tags, doesn't work. what's wrong here?
Comments
Post a Comment