ColdEdge 0 Posted January 9, 2011 Report Share Posted January 9, 2011 (edited) Hello, I have a question. I seen many Cloud Hosting sites use jQuery for there primary choice not only that I seen this kind of urlshttp://sitename.com/photo169#photo/165Can I aks how can I load a page or something using # command with jQuery? Edited January 9, 2011 by ColdEdge Quote Link to post Share on other sites
ApocalypeX 3 Posted January 9, 2011 Report Share Posted January 9, 2011 (edited) Hello, I have a question. I seen many Cloud Hosting sites use jQuery for there primary choice not only that I seen this kind of urlshttp://sitename.com/photo169#photo/165Can I aks how can I load a page or something using # command with jQuery?Essentially it's using location.hashhttp://www.w3schools.com/jsref/prop_loc_hash.aspI think what they do is they use the hash property as a "Javascript-like query" like PHP's ? url queries. They then write their own querying system. For example:query = location.hash;switch(query){case "photo"://do something...} Edited January 9, 2011 by ApocalypeX Quote Link to post Share on other sites
thescientist 231 Posted January 9, 2011 Report Share Posted January 9, 2011 You can use the # with an anchor tag to focus on a specific part of the page. When you append that to the end of a URL, the page would load and then focus on that particular part of the page.http://www.w3schools.com/html/html_links.aspUsing the link that Apocalype X provided, if you need to, you can get just that part of the URL when the page loads.So yes, it's kind of like PHP, where a GET URL would like like this:www.somesite.com?link=hereand PHP could access it this way.$var link = $_GET['link'];except you are using Javascript to do it instead. As far as I know, it is not something specific to jQuery. Quote Link to post Share on other sites
thescientist 231 Posted January 9, 2011 Report Share Posted January 9, 2011 Essentially it's using location.hashhttp://www.w3schools.com/jsref/prop_loc_hash.aspI think what they do is they use the hash property as a "Javascript-like query" like PHP's ? url queries. They then write their own querying system. For example:query = location.hash;switch(query){case "photo"://do something...} just a note, if you were going to build a conditional off the location.hash method, you would have to include the #, or remove it. i.e.query = location.hash;switch(query){case "#photo"://do something...} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.