O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading data with AJAX

In this recipe, we will discover how to load data asynchronously using the Ext.Ajax class. We will demonstrate how to use the Ext.Ajax.request method for loading data and how to process the XMLHttpRequest response that's returned. Additionally, we will learn how to handle errors.

Getting ready

Make sure you have a web server installed and running on your development computer.

For the purposes of this demonstration your web server will need to serve JSON files. If you run into problems you may need to add a MIME type for JSON (application/json).

How to do it...

  1. Create a file called ajaxRequest.json and add some JSON:
    {
        "id": 1,
        "firstname": "John",
        "lastname": "Smith"
    }
  2. Create an Ajax request with Ext JS by adding the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required