How to solve the issue of "XHR request timed out"

I developed luci page
I added a button which execute linux command.
The linux command take time
and this cause that the Luci GUI return the following error:

"XHR request timed out"

How to fix it?