$.post does not work? why?
Why this line never work?
$.post("external mail.php file", $("#commentForm").serialize());
Thanks
Here is my form,
- <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' type='text/javascript'/>
<script src='http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js' type='text/javascript'/>
<script type='text/javascript'>
/*<![CDATA[*/
$(document).ready
(
function()
{
$("#commentForm").validate
({
submitHandler: function()
{
$.post("external mail.php file", $("#commentForm").serialize());
$("#commentForm").slideUp
("normal", function()
{
$("#commentForm").replaceWith('<h1>Success</h1><p>Your email was sent.</p>');
}
);
return false;
}
});
}
);
/*]]>*/
</script>
-
<style type="text/css">
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
</style>
<form class="cmxform" id="commentForm" method="post" action="">
<fieldset>
<legend>You can submit here</legend>
Name
<em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" />
E-Mail
<em>*</em><input id="cemail" name="email" size="25" class="required email" />
URL<input id="curl" name="url" size="25" class="url" value="" />
Your comment
<em>*</em><textarea id="ccomment" name="comment" cols="22" class="required"></textarea>
<input class="submit" type="submit" value="Submit"/>
<input type="reset" class="reset" value="Reset" />
</p>
</fieldset>
</form>