0

It's probably a very basic question, but I wasn't sure how to Google it.

I got this JS:

$(document).ready(function(){
$("#cboxFormButton1").click(function(e){
e.preventDefault();
$.colorbox({
href: $(this).closest('form').attr ('action'),
data: {a: $("input#aaa").val()}
});

return false;
});
});

and this form:

<form action="rrr1.php" method="POST" target="_blank" class="">
    <input id="aaa" name="a" type="hidden" value="1"/>
    <input id="bbb" name="b" type="hidden" value="2"/>
    <input type="submit" id="cboxFormButton1" class="button" value="Test">
</form>

right now the code extracts only the data for the "a" input and pass it on to the PHP. what do I need to change this line to:

data: {a: $("input#aaa").val()}

so it would get the data for the "b" input as well?

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
rockyraw
  • 1,125
  • 2
  • 15
  • 36

1 Answers1

2

Try to use this:

data: {
  a: $("input#aaa").val(), 
  b: $("input#bbb").val()
}
Matthew Blancarte
  • 8,251
  • 2
  • 25
  • 34
juvian
  • 15,875
  • 2
  • 37
  • 38