I have put the following code in the preview button:
js: E.prvAjax(); MathJax.Hub.Typeset();
The second processes the page on the client's computer. It does not work as expected, as the client-side processing takes place directly after the loading message is shown, and not after it is completed. Any workaround?

A php button, starting with php:, allows you to perform server-side processing. You should not try it unless you are familiar with PHP.
Actually, I intend to use the default E.prvAjax(); function, but I want to use MathJax.Hub.Typeset(); (which performs client-side processing with no server interaction) AFTER the preview has been completed. If I do what I described, it just processes the "loading..." text, instead of the proper server response.