This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

jerry3850
jerry3850

Can someone please provide an example of how to use the "data-request-loading" AJAX attribute to display an AJAX loading indicator while a request is executing.

jerry3850
jerry3850

I figured it out, so I will answer my own question. First, create a div with your loading image as shown below and place the image where you want to display it.

<div id="loading" style="display: none;"><img src="loading.gif" alt="Loading..." /></div>

Then, as an example, set up the form tag as follows:

<form
    data-request="onCalculate"
    data-request-update="'calcresult: '#result''"
    data-request-loading="#loading"
>
Jeroen Noten
Jeroen Noten

Thanks! This was helpful.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.