The following diagram summarizes the asynchronous loading of files by the web browser using AJAX:
Let's analyze this more closely:
- Request File: Indicates the path to the file you want to load. Remember that this file contains the geometry that we will be loading from the web server instead of coding the JavaScript arrays (vertices and indices) directly into the web page.
- AJAX Request: We need to write a function that will perform the AJAX request. Let's call this function load. The code looks like this:
// Given a path to a file, load the assets asynchronouslyfunction load(filePath) { // We return the promise ...