How to use AJAX requests to retrieve HTML or JSON content
This article will present a very simple Use Case that can be used in many situations.
The Widgets presented here can retrieve content either in JSON or HTML format using AJAX calls, and display the result.
We are going to use a few tools to demonstrate the feature:
- a simple Web server using Node.js
- a tunneling solution with ngrok to expose your local server on a public secured URL
- a monitoring tool called nodemon to restart your local server in case of changes
A few best practices will be described in the attached PDF such as:
- using asynchronous calls to retrieve content in Widget code