How to pass another parameter and value with another variable via post?

0

I need to send a new variable, using jQuery , to the neighborhood.php file, how do I?

I have a hidden input that contains the idcl variable that contains client data:

<input type="hidden" name="idcl" id="idcl" value="<?php echo $cliente; ?>" size="3">

How do I pass these data to the routine below?

Follow the Java Script code:

   $.post("bairro.php",
             {cidade:$(this).val()},
                function(valor) {
                   $("select[name=bairro]").html(valor);
                   ...
    
asked by anonymous 10.12.2015 / 10:45

2 answers

1

Just grab the id, using jquery , as you're already doing:

  $.post("bairro.php",
              {cidade:$(this).val(), idcl: $("#idcl").val()},

              function(valor){
                 $("select[name=bairro]").html(valor);

I suggest a read on these links too:

link

link

    
10.12.2015 / 11:03
2
$.post( "test.php", { nome: "John", hora: "2pm" } );

or in case of an array submission.

$.post( "test.php", { 'nomes[]': [ "Jon", "Susan" ] } );

Tailoring your routine:

   $.post("bairro.php",
              {cidade:$(this).val(),idcl:$("#idcl").val()},

              function(valor){
                 $("select[name=bairro]").html(valor);

I do not know how your instances are arranged, but it serves as a basis. hugs.

font

    
10.12.2015 / 10:59