Symfony 3.2 – Loading state till the page fully loaded


Hello everyone,

I’m stuck at some javascript / symfony issue. I got a page that takes more than 10 secondes to load (a lot of forms in it).

The problem is that when the page shows up, it is only the html that works and when users start playing with the forms, its not working (cause its stacks ajax requests and return nothing).

here an example set of ajax reponses for this page

So I handled a part of it by setting a loading state for each submit. (I used gasparesganga loading library ).


Everything works good when the page is fully loaded.

But the problem persists between the landing on the page and the time it fully load.
I tried to display a spinner when the user get on the page :

window.onload = function() {
        console.log('window loaded');

Or try to replace the at the beginning of my code:


But none of this works; thus when I land on the page, I see first the HTML for 8 seconds and then it shows the spinner.

So my question concerns the fact that Symfony have a role in this : the controller do his calculations and it displays the view as it is till it gets the full informations — and next load the JS.
If someone could give me some hint, it would be great !

Thanks for the reading and for your help.