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
  • 24,971
  • 24
  • 101
  • 136
rockyraw
  • 1,115
  • 2
  • 15
  • 34

1 Answers1

2

Try to use this:

data: {
  a: $("input#aaa").val(), 
  b: $("input#bbb").val()
}
Matthew Blancarte
  • 8,151
  • 2
  • 23
  • 34
juvian
  • 15,610
  • 2
  • 34
  • 36