javascript - get url parameter in jQuery not working -


this link of page:

localhost/basket/newstext.html?url=http://www.basket-planet.com/ru/news/9246

when page loaded, i'm trying alert url know it's in variable. it's not. found many methods , none work me. don't understand why!!! html page:

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

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 = 0; < hashes.length; i++) {     hash = hashes[i].split('=');     vars.push(hash[0]);     vars[hash[0]] = hash[1]; } return vars; } 

i'm desperate answer this...please out!!!

update: here js script appends links , articles on first page:

var serviceurl = "http://localhost/basket/services/"; var news; $('#mainnews').bind('pageinit', function(event) { getnews(); });  function getnews() { $.getjson(serviceurl + 'getmainnews.php', function(data) {     $('#fnews li').remove();     mainnews = data.items;     $.each(mainnews, function(index, mnews) {         $('#fnews').append('<li data-icon="false"><a style="white-space:normal;" href="newstext.html?url=http://www.basket-planet.com' + mnews.link + '">' + mnews.article + '</a></li>');     });     $('#fnews').listview('refresh'); }); } 

i got work. seeing how page transitions being handled, , should have rememberd when reading it, jquery mobile handles through ajax. fix add $.mobile.ajaxenabled = false; in first page pages handle normal web pages.

if can add , tell me how with ajax enabled, great. struggling, that's solution found. helping!


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -