tag:blogger.com,1999:blog-865923359735383241.post7878329438696606236..comments2023-10-29T07:27:09.012-06:00Comments on Ccna final exam - java, php, javascript, ios, cshap all in one: AJAXify siteUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-865923359735383241.post-27729656894865153922012-04-12T03:15:46.480-06:002012-04-12T03:15:46.480-06:00The best way to do this is to have one index.php t...The best way to do this is to have one index.php that loads all other pages based on the URL parts after it. For instance:<br /><br />http://www.example.com/index.php/reports/employees/hoursWorked<br /><br />In this case index.php will run, it can see what's being requested is is the hours worked report, and load that content. The problem is, if index.php then loads all other content after that using AJAX, the URL in the browser will never change.<br /><br />One way around that problem would be to put a "Link to this page" link on every page that contains that form of URL for users to bookmark.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-90635699157233187882012-04-12T03:15:45.936-06:002012-04-12T03:15:45.936-06:00jQuery History is my preferred choice. It can be f...jQuery History is my preferred choice. It can be found here: http://www.balupton.com/projects/jquery-history/ Provide cross browser support, binding to hashes, overloading hashes, all the rest.<br /><br />There is also an Ajax extension for it called jQuery Ajaxy, allowing it to easily upgrade your webpage into a proper Ajax application without need for server side changes and remaining SEO and JS-Disabled friendly: http://www.balupton.com/projects/jquery-ajaxy/<br /><br />This is the solution chosen by such sites as http://wbhomes.com.au/ and http://www.balupton.com<br /><br />Overall they are both well documented, supported and feature rich. They've also won a bounty question here http://stackoverflow.com/questions/3205900/how-to-show-ajax-requests-in-url/3276206#3276206Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-78477922445181886182012-04-12T03:15:45.274-06:002012-04-12T03:15:45.274-06:00Well you can use one of these tools or roll your o...Well you can use one of these tools or roll your own. Uses window.location.hash along with other tricks.<br /><br /><br />YUI - Browser History Manager <br />Really Simple History (RSH)Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-89005335286152549152012-04-12T03:15:44.512-06:002012-04-12T03:15:44.512-06:00The answer is no, you can't get the value of t...The answer is no, you can't get the value of the URL hash server side. See How to get Url Hash (#) from server side.<br /><br />You'll have to get the hash value client-side and make an extra request.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-77055283016375088582012-04-12T03:15:43.704-06:002012-04-12T03:15:43.704-06:00It's a fairly simply process of (1) Parsing th...It's a fairly simply process of (1) Parsing the hash tag, and (2) Loading the content via Ajax as you normally would. <br /><br />If you load more content when the user clicks on the page, just be sure to always correctly modify the hash tag to reflect what's on the page. <br /><br />Here's a quick example to play around with. Click on a name and note the hash tag. The relevant Javascript looks like this :<br /><br />// Go straight to content if it's in the hash.<br />$(document).ready(function(){<br /> load_story_from_hash();<br />});<br /><br />// Call this function whenever user clicks on a hash link<br />function set_hash(hash){<br /> window.location.hash = hash;<br /> load_story_from_hash()<br />}<br /><br />// Actually load content based on the hash in the URL<br />function load_story_from_hash(){<br /><br /> var hash = window.location.hash;<br /> hash = hash.replace(/^#/, '');<br /><br /> if (hash) {<br /><br /> $('#post_container').load(hash+'.html', {}, function(){<br /> $.scrollTo('#post_container', 1000);<br /> });<br /><br /> }<br /><br />}Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.com