How to submit a form in modal form
Hi
Im new to JQuery and want to know how i can submit a form that is in a JQuery Dialog Modal Form.
I have a button on my main page, which opens up a modal form, with a form inside. Here are 2 snippets from the code.
- <script type="text/javascript">
$(function(){
- // Dialog
$('#dialog').dialog({
autoOpen: false,
width: 330,
buttons: {
"OK": function () {
- alert("FORM SHOULD SUBMIT HERE");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
// Dialog Link
$('#dialog_link').click(function(){
$('#dialog').dialog('open');
return false;
});
//hover states on the static widgets
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
});
</script>
Code on the dialog.
- <div id="dialog" title="Search by Job Number"><form action="SearchByJob.asp" method="post" name="JobForm">
<p>Enter Job Number: <input name="JobNumber" type="text" class="TextSmallBlack" id="JobNumber" size="30"></p><form>
</div>
How can i get the form to submit to the SearchByJob page?. If i put $("JobForm").submit() under the OK function, nothing happens.