Book Image

Web Developer's Reference Guide

By : Joshua Johanan, Talha Khan, Ricardo Zea
Book Image

Web Developer's Reference Guide

By: Joshua Johanan, Talha Khan, Ricardo Zea

Overview of this book

This comprehensive reference guide takes you through each topic in web development and highlights the most popular and important elements of each area. Starting with HTML, you will learn key elements and attributes and how they relate to each other. Next, you will explore CSS pseudo-classes and pseudo-elements, followed by CSS properties and functions. This will introduce you to many powerful and new selectors. You will then move on to JavaScript. This section will not just introduce functions, but will provide you with an entire reference for the language and paradigms. You will discover more about three of the most popular frameworks today—Bootstrap, which builds on CSS, jQuery which builds on JavaScript, and AngularJS, which also builds on JavaScript. Finally, you will take a walk-through Node.js, which is a server-side framework that allows you to write programs in JavaScript.
Table of Contents (22 chapters)
Web Developer's Reference Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
9
JavaScript Expressions, Operators, Statements, and Arrays
Index

Using AJAX in jQuery


Asynchronous JavaScript and XML (AJAX) was the base building block of Single Page Applications (SPAs). This method is used to update the content of a web page without reloading the whole page. This method helps save precious resources and decreases the time taken for loading a page considerably, since only parts of the page are reloaded and not the entire page.

More than often, you have visited the Google search page for searching answers to your questions. Have you noticed how the page displays results as you type into the search box and provides useful suggestions of related searches? Or the product filters on Amazon and Ebay websites. These effects are achieved with AJAX.

The jQuery Ajax load

The load() method loads data from a server and puts the returned data into the selected element.

Its syntax is as follows:

$(selector).load(URL,data,callback);

Parameters

The load() method take the URL, data, and callback as parameters.

The callback parameter can have the following...