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

Asked

Viewed 988 times

0

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

I have an input like Hidden containing the variable idcl which contains customer data:

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

How do I pass this data to the routine below?

Follow the Java Script code:

   $.post("bairro.php",
             {cidade:$(this).val()},
                function(valor) {
                   $("select[name=bairro]").html(valor);
                   ...
  • Within the post?

  • yes, how do I?

  • Can you assemble this modified structure to pass a variable? for example?

  • Which variable do you want to pass? Where and how do you catch it? Your question is very vague, click [Edit] and detail your problem better.

  • he ta doing post. don’t get the.O

  • 1

    I don’t think it’s duplicate.

  • The logic you will use is the same that was answered in your other question on that same subject Send more than one parameter in GET request. GET and POST has practically the same treatment. I suggest reading on the subject, see this article to start.

Show 2 more comments

2 answers

2

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

or in case of sending of matrix.

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

Adapting your routine:

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

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

I don’t know how you’re willing to take your time, but it serves as a basis. Hugs.

source

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.