Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
JavaScript and JSON Essentials

You're reading from   JavaScript and JSON Essentials Build light weight, scalable, and faster web applications with the power of JSON

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher
ISBN-13 9781788624701
Length 226 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
 Joseph D'mello Joseph D'mello
Author Profile Icon Joseph D'mello
Joseph D'mello
Sai S Sriparasa Sai S Sriparasa
Author Profile Icon Sai S Sriparasa
Sai S Sriparasa
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
1. Getting Started with JSON FREE CHAPTER 2. The JSON Structures 3. AJAX Requests with JSON 4. Cross-Domain Asynchronous Requests 5. Debugging JSON 6. Building the Carousel Application 7. Alternate Implementations of JSON 8. Introduction to hapi.js 9. Storing JSON Documents in MongoDB 10. Configuring the Task Runner Using JSON 11. JSON for Real-Time and Distributed Data 12. Case Studies in JSON 1. Other Books You May Enjoy Index

Making your first AJAX call


Now that we have an active JSON data feed, it is about time to make our first AJAX call. We will look at different approaches to making an AJAX call; this technology and the way it is used have evolved over a period of time with the aim of improving performance. The first approach will use basic JavaScript so that we understand what happens behind the scenes when an AJAX call is made. Once we understand the concept of AJAX, we will use some popular libraries to make the same AJAX call but with some variations. Let's take a look at our first approach, using basic JavaScript by creating a basic.html file with the following template:

<!DOCTYPE html>
<html>
<head>
  <title>First AJAX script</title>
  <script type="text/javascript" src="basic.js"></script>
</head>
<body>
  <h2>Include external Javascript to make an ajax call</h2>
  <p>This is a test program to make our first AJAX call using javascript...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images