To this, I would:
- Manually submit the form by serializing the form as an array
- Then, submit the data using
get
, post
, or ajax
.
- Write the response to an invisible
div
and then use colorbox
on this div
.
Example:
$("#myForm").submit(function(){
var formData = $(this).serializeArray();
$.get("mypage", formData, function(r){
$("body").append("<div id='response'></div>");
$("#response").hide().html(r).colorbox();
});
return false; // To override non-ajax submitting
});
Modifications you might have to make:
- Change
get
to post
or ajax
- Change the
div
that the response gets dumped to (perhaps generate a div with a random ID instead of using a constant, response
, as the ID)
Also:
I'm thinking that I have to convert
the form data into a get string, put
that on the end of the url to open,
and then send that to colorbox.
This would work, but only if your form works with get
. I wouldn't recommend using get
for forms in general, as this can lead to nasty CSRF and XSS attacks.