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?

4
  • data: { a: $("#aaa").val(), b: $('#bbb').val() } ? Commented Feb 23, 2014 at 1:33
  • Take a look at this: stackoverflow.com/questions/2276463/… Commented Feb 23, 2014 at 1:34
  • Why are you doing it like this? Your going backwards. Commented Feb 23, 2014 at 1:44
  • @RPM what are you referring to? Commented Feb 23, 2014 at 1:46

1 Answer 1

2

Try to use this:

data: {
  a: $("input#aaa").val(), 
  b: $("input#bbb").val()
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.