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

295
Vistas
How to post two variables with jQuery AJAX

How to post two variables with jQuery AJAX? One variable work fine but two variables not working

function get() {
    $('#age').hide();
    $.post('jrecomment2.php',{ userID: form.userID.value },{ id_number: form.id_number.value }

    function(output){

        $('#age').html(output).slideDown(2000);


        });

}

and the form:

<form name="form" dir="rtl">
    <input type="text" name="userID">
    <input type="text" name="id_number">
    <input type="button" value="submit" style=" width: 120;" onClick="get();"> 

</form>
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

You need to use { userID: form.userID.value, id_number: form.id_number.value }.

over 4 years ago · Santiago Trujillo Denunciar

0

$.post('jrecomment2.php',{ userID: form.userID.value, id_number: form.id_number.value }, function(output){ });
over 4 years ago · Santiago Trujillo Denunciar

0

you can use this code

 $.ajax({
            type: "POST",
            url: 'jrecomment2.php',
            data: 'userID=' + form.userID.value+'&id_number='+form.id_number.value,
            dataType: 'text',
            async: false,
            cache: false,
            success: function (output) {

            $('#age').html(output).slideDown(2000);
            }
        });

and post method

$.post('jrecomment2.php',{ userID: form.userID.value, id_number:     form.id_number.value }, function(output)
 { 
   $('#age').html(output).slideDown(2000);
 }
);
over 4 years ago · Santiago Trujillo 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