Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Traffic Cop

For my next series of examples, I’m going to write a single page called iphone.html that will sit in front of all of the site’s other pages and will handle requests, sort of like a traffic cop. Here’s how it works. On first load, iphone.html will present the user with a nicely formatted version of the site navigation. I’ll then use jQuery to “hijack” the onclick actions of the nav links so that when the user clicks on one, the browser page will not navigate to the target link. Rather, jQuery will load a portion of the HTML from the remote page and deliver the data to the user by updating the current page. I’ll start with the most basic functional version of the code and improve it as we go along.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint