Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
form doesn't show loading

I use a form to upload data:

<form method="POST" action="{{ Route('files.create') }}" enctype="multipart/form-data" onsubmit="event.preventDefault(); showSpinner();">
<!-- ... -->
</form>
<script>
        const showSpinner = () => {
            document.getElementById('btnSubmit').innerHTML =
                'Loading ...';
            document.querySelector('form').submit();
        }
    </script>

If I don't submit the form, I see the loading text. If I do, I don't see it. If I upload a big amount of data, this is annoying because the user has now feedback if it is uploading or not.

How can I show the loading text while the server (?) or client (?) is processing (?) the form?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use this

    var spinner = $('#loader');
$(function() {
  $('form').submit(function(e) {
    e.preventDefault();
    spinner.show();
    $.ajax({
      url: 'filename.php',
      data: $(this).serialize(),
      method: 'post',
      dataType: 'JSON'
    }).done(function(resp) {
      spinner.hide();
      alert(resp.status);
    });
  });
});

also check this click here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!