Parsing JSON data

Now that we are familiar with jQuery, let us trigger an AJAX request on an event such as a button click.

Parsing JSON data

In this snippet, let us begin by observing the HTML document object. We have a div element that has an empty unordered list. The aim of this script is to populate the unordered list with list items on the click of a button. The input button element has an id with the value "getFeed", and the click event handler will be tied to this button. Since AJAX is asynchronous and as we are tying a callback to this button, no AJAX calls are made to our live server when the document object is loaded. The HTML structure alone is loaded onto ...

Get JavaScript and JSON Essentials 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.