Tag: Express
-
Dynamic content loading on web pages with Ajax & Express (2)
It is the second example using JQuery AJAX function and Express JS. The Express server will cycle through the colors ‘red’, ‘yellow’, ‘green’, and ‘blue’ when the route /colorword is accessed by AJAX. The colorword.html file displays a heading (<h1>) that initially has the color red. On page load, an AJAX request is sent to /colorword to retrieve the color, and… Read more
-
Dynamic content loading on web pages with Ajax & Express (1)
Dynamic content loading involves updating or loading content on a web page without the need for a complete page refresh. JavaScript plays a crucial role in enabling dynamic content loading by facilitating the retrieval and manipulation of data asynchronously. This approach offers several benefits: AJAX (Asynchronous JavaScript And XML) is a well-established method for achieving… Read more
-
Static HTML with express route
Example 1 To create an Express route in a file named index.js that handles a HTTP GET request for the path /lastvisit and responds with a plain text containing the timestamp of the previous visit. If a previous visit timestamp exists, it will be sent as plain text in the response. Otherwise, it will respond with “First visit”. Content… Read more