jqModal, Ajax, and form submission
Hi,
I'm new to jqModal and have been running into what I presume is a fairly simple problem. I want to:
1) Open a jqModal window which displays a form
2) The user will complete and submit this form via Ajax
3) The form will display an appropriate message, at which point the user can close the window
I can both open the window and display the form no problem. However #3 is giving me grief. For that matter, I can't even cause an alert window to appear when the form's submit button is pressed. So here's what I have:
1) Open a jqModal window which displays the form
The following does the trick nicely, open the form when the user clicks on any element defined by the paragraph tag:
-
google.setOnLoadCallback(function() {
$("p").click(function(){
$('#ex2').jqm({closeClass: 'jqmClose', ajax: '/guid/comment/', modal: true}).jqmShow();
});
})
2) The user will complete and submit this form via Ajax
The code found in /guid/comment looks like this:
-
<div id="comment_form">
<div style="float: left;">
<b>Add a Comment</b>
</div>
<div style="float: right; text-align: right">
<img class="jqmClose" src="/images/icons/cancel.png" />
</div>
<br /><br />
<form id="comment_on_guid" method="POST">
<input type="hidden" name="guid" value="<?= $this->guid; ?>" />
<p>
Your comment:<br />
<textarea name="comment" cols="35" rows="10"></textarea>
</p>
<p>
<input type="submit" name="submit" id="submit_comment" value="Add Comment" />
</p>
</form>
</div>
Again, up to this point I have no problems. But I can't get that form to respond to any JavaScript event!!! Even attempting to listen for form submission will not work:
$("#comment_on_guid").submit(function(){
alert("HELLO");
});
Any ideas? Thank you!
Jason