How to Read Data with jQuery


show more Reading data with jQuery provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript and AJAX show less
please wait ...

Reading data with jQuery

In the last movie we used jQuery's load method to load some text from an external source. If you're looking to load structured data, jQuery has a method called getJSON. As the name implies, it's designed to load data in the JSON format. So once again, I'm beginning with a simplified version of our HTML file. It's pretty much just a div with an ID of update, and then they call to jQuery, as well as our script file. Our script file right now is empty, and we're going to need a file called data.json. It has the data that we need to load into our document.

So in our script file we'll start off by calling the getJSON method. We'll pass it along the file name that we want to load and then we'll create a function. This would be a function literal so it will have no name. And we want to pass along the data that we get from the getJSON command into this function. So let's go ahead and output the data to our console so we can take a look at it. So let me save...

Reading data with jQuery
Video duration: 4m 19s 1h 12m Intermediate

Viewers:

Reading data with jQuery provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript and AJAX

Subjects:
Developer Web
Software:
Ajax JavaScript
Author:
please wait ...