jQuery: Post form to a modal window for previewing the entered data

Posted by superUntitled on Stack Overflow See other posts from Stack Overflow or by superUntitled
Published on 2011-01-04T20:56:24Z Indexed on 2011/01/04 22:54 UTC
Read the original article Hit count: 170

Filed under:

I am looking for a way to use jQuery to allow a user to look at a modal window "preview" of a form before they submit the form to be saved.

I have this working with javascript, the form is posted to a file named preview.php that iterates through the posted information. The script currently opens a new window.

I would like instead to use jQuery to post the form to a modal window for previewing. Does anyone have any thoughts on how to do this?

This is what I am currently using:

<script language="JavaScript">
function preview(form) {
  form.target='_blank';
  form.action='http://example.com/preview.php';
  form.submit();
}
</script> 
<input type="button" value="preview" onclick='preview(this.form)'>

© Stack Overflow or respective owner

Related posts about jQuery