0
I have a download button that makes a GET request that makes a Download. It all happens on the same page, but without AJAX.
Not using the tag download
. Is using the Laravel
that internally makes the download service.
I would like a message to appear on the button when pressing the Download button same "Wait...".
When you finished the page loading process and started the download, return the previous message from the button.
I tried to do it like this, but it doesn’t work:
$('.btn-export').on('click', function(){
$(this).text('EXPORTANDO...');
$(window).on('load', function(){
$('.btn-export').text('EXPORTAR');
});
});
Any idea?
If you could say which part does not work: changing the text or returning the text, or both.
– Sam
What the text returns to.
– Diego Souza
Look, the $(window). on(load... will not take effect inside the onclick button... put it outside so that the page can perform it when it is loaded
– Sam
It doesn’t work. I’ve tried.
– Diego Souza
Just so I’m clear: this whole process takes place without page refresh?
– Sam
From what I understand, when you click the button download, the page is reloaded. Is that it? If so, what you should do is delay loading the page so that the display of
$(this).text('EXPORTANDO...');
is visible. Otherwise, the page will reload and you will lose all dynamic modifications on GIFT. This delay is not a good practice in my opinion. Already the$(window).on('load', ...);
has no use within the scope of the button.– user98628