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

169
Views
ajax refresh php code on submit without refresh page

I use form for input date to DB. After submit form I need refresh php code (because when form is submit then I need display this value sent, instead of this form.)

I've script:

  $(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("Tworzenie...")
    $.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 user")
        }
    });
    $.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("Potwierdź")
        }
    });
  })

I can implement to this code refresh page below script:

    document.getElementById("form_create_user").onsubmit = function(){
    window.location.replace("<?php echo $course_details_url_back; ?>");
}

But the problem is, I have main tab and togle switch tabs with end url #user #domain etc. example:

- mydomain.com/course
- mydomain.com/course#user
- mydomain.com/course#domain

When I run url in browser: mydomain.com/course#user then still is displayed main tab with url mydomain.com/course This working only on switch tabs (without directly run url) So when I use above solution this stil reload page and back to main mydomain.com/course

So I need to find any solution for implement to above script refresh php code without reload 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!