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

166
Vistas
converting XMLHTTPRequest To jquery ajax

I try lots of ways to convert my XMLHTTPRequest into jQuery ajax but I couldn't be successful.

I would be really appreciate if anyone could help me solve this issue.

here is my XMLHttpRequest Code:

    var url = url;
    var xhr = new XMLHttpRequest();
    xhr.open("POST", url);    
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    xhr.onreadystatechange = function () {
       if (xhr.readyState === 4) {
           console.log(xhr.status);
           console.log(xhr.responseText);
    }};
    
    var data = "ajax=1";  
    xhr.send(data); 

and here is my attempt but its not working

$.ajax({
             url: "<?php echo $this->ui_url('onlineexamcats', 'all'); ?>",
             data: JSON.stringify("ajax=1"),
             type: "POST",
             processData: false,
             contentType: false,
             beforeSend: function(xhr){xhr.setRequestHeader('Content-Type',  "application/x-www-form-urlencoded");},
             success: function(res) { console.log(res); }
          });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this

$.ajax({
    url: "<?php echo $this->ui_url('onlineexamcats', 'all'); ?>",
    data: "ajax=1",
    type: "POST",
    processData: false,
    success: function(res) { console.log(res); }
});
about 4 years ago · Juan Pablo Isaza Denunciar
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