Time for action – adding Ajax magic
If you click around this small and simple site in your browser, you'll see that we're reloading the same header, navigation, sidebar, and footer over and over again. Only the content in the main content area of the page is changing from page to page. Let's use the magic of jQuery to fix that.
- Just a reminder that these Ajax functions won't work unless your pages are being served by a server. To see this code in action, you'll either have to upload your pages to a server or create a server on your own computer. First, we'll open our
scripts.js
file and set to work writing our code. We'll get started as we often do with the document ready statement as follows:$(document).ready(function(){ // Our code will go here ...
Get jQuery for Designers Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.