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

130
Views
Javascript input form | display "creating... " and refresh page

Below I have script js and form.

$(document).on('submit','#form_create_user',function(e){
    e.preventDefault();
    var fd = new FormData(this);
    var obj = $(this);
    fd.append('course_id', "<?php echo $this->uri->segment(4); ?>");
    obj.find('input[type="submit"]').val("Creating...")
    $.ajax({
        url: $(this).attr("action"),
        data: fd,
        cache: false,
        processData: false,
        contentType: false,
        type: 'POST',
        success: function (dataofconfirm) {
            // do something with the result
           // obj.find('input[type="submit"]').val("Confirm")
        }
    });
    $.ajax({
        url: "<?php echo site_url('home/saveValues/'); ?>",
        data: fd,
        cache: false,
        processData: false,
        contentType: false,
        type: 'POST',
        success: function (dataofconfirm) {
            // do something with the result
            toastr.success("Success created user.");
            obj.find('input[type="submit"]').val("Confirm")
        }
    });
  })
<form action="?" method="post" name="form_create_user" id="form_create_user">
      <input name="username" type="text" id="username" value="test"><input type="submit" name="Submit" value="Confirm">
</form>

When I click on submit form then this script change text on button from "create" to "creating..." and display success action. But now this take about 1sec.

I need extand this script and I need: display "creating..." for one minute and then return a success action.

note: the script run by form I need to set to run immediately, but only return success after a minute and reload the page.

Can anyone help me?

about 4 years ago · Juan Pablo Isaza
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!