Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda