Wednesday, September 4, 2013

Question: I am using jQuery. How do I get the path of the current URL and assign it to a variable?








Whe can use => $(location).attr('<property>');




 
http://www.you-tracker.com:8080/default.aspx#top?id=123


Property    Result
-------------------------------------------
host        www.you-tracker.com:8082
hostname    www.you-tracker.com
port        8080
protocol    http
pathname    default.aspx
href        http://www.you-tracker.com:8080/default.aspx#top
hash        #top
search      ?id=123


var x = $(location).attr('<property>');

No comments:

Post a Comment