Using AJAX

This is a sample showing how to use an AJAX request to update content inside a page. Two ways are shown how this can be done. In general, the location of the page which needs to be updated has to be identified. For that an id (updated-by-interval, updated-by-button) attribute is used. The update process is done using the JQuery load() method which is available for any HTML tag. The first usage of AJAX can be found in the script section using an interval, the second usage is inside the button element. In the first case, an AJAX request is sent to the gettime.cxp page once a second. In the other case, the AJAX request is triggered by the user by clicking on the button (init-button).

Run in new tab
Live editor
Result built with V2 2156
I'm a warning toast!
I'm a success toast!