【发布时间】:2015-05-14 12:46:04
【问题描述】:
我正在使用 jQuery 插件来通知 toastr js (http://codeseven.github.io/toastr/),我正在尝试在通知气球中添加一个联系表单,并在提交时使用 AJAX。
即使该表单在toastr.info('') 之外工作,我也无法在脚本中实现它。当我点击提交时,它会刷新页面。
我该如何解决这个问题?
Ajax 脚本
$(function(){
$("#contactform").submit(function(event){
event.preventDefault();
$.post('mailme.php', $("#contactform").serialize(), function(data) {
});
});
});
HTML 表单
<form id="contactform" method="post" name="myform">
<input name="phone" type="text"><input id="submit" name="Submit" type="submit" value="send">
</form>
toastr.info('I put the above HTML code in here')
小提琴
【问题讨论】:
标签: javascript jquery html ajax toastr