This simple project demonstrates 2 AJAX functions. Clicking the buttons will fire the functions. One receives a response from a JSON file, and the other will re-direct to another URL, but an erroneous one. The responses will be displayed on the page.
There is a bonus game included. Move the explorer with the arrow keys (if it does not respond, click on the game). Grab the treasure chest and take it to each door to see the AJAX magic. Avoid the blobs!
Package/Dependecy | Description |
---|---|
express | Fast, unopinionated, minimalist web framework for node. Used to setup server. |
jQuery | Fast, small, and feature-rich JavaScript library. It makes Ajax simpler. |
Open project's root folder in Terminal/Bash and run:
npm install
In Terminal/Bash window use:
node server.js
To run the app.
Visit localhost:3009
to view the app.
ajaxHelloWorld
├─ assets
│ ├─ ajaxRequest.js
│ ├─ hello.txt
│ ├─ info.json
│ └─ styles.css
├─ index.html
├─ readme.md
└─ server.js