-
精工机械轴承生产厂家类...
-
养殖设备类网站pbootcms模...
-
投资理财金融公司类网站...
-
品牌策划设计类网站pb...
-
链条导轨张紧器类网站...
-
恋爱情感资讯类网站pb...
-
儿童乐园玩具类网站pb...
-
激光切割机类网站pboot...
-
代理记账财务公司类网站...
-
餐饮美食加盟类网站pb...
-
品牌包包定制类网站pb...
-
网络品牌广告设计类网站...
-
空压机类网站pbootcms模板...
-
五金制品类网站pbootcms模...
-
展会展览会类网站pboot...
-
汽车零配件类网站pboot...
-
新闻博客教程资讯类网站...
-
外国语学校类网站pboot...
-
网络公司应用开发类网站...
-
新闻资讯网站教程类网站...
Ajax提交<form onsubmit="return submsg(this);">
联系人<input type="text" name="contacts" required id="contacts">
手 机<input type="text" name="mobile" required id="mobile">
内 容<textarea name="content" id="content"></textarea>
验证码<input type="text" name="checkcode" required id="checkcode">
<img title="点击刷新" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
<button type="submit">提交留言</button>
</form>
<script>
//ajax提交留言,由于涉及到提交地址标签的解析,JS需要放在html文件中
function submsg(obj){
var url='{pboot:msgaction}'; //如果是自定义表单则使用地址{pboot:form fcode=*}
var contacts=$(obj).find("#contacts").val();
var mobile=$(obj).find("#mobile").val();
var content=$(obj).find("#content").val();
var checkcode=$(obj).find("#checkcode").val();
$.ajax({
type: 'POST',
url: url,
dataType: 'json',
data: {
contacts: contacts,
mobile: mobile,
content: content,
checkcode: checkcode
},
success: function (response, status) {
if(response.code){
alert("谢谢您的反馈,我们会尽快联系您!");
$(obj)[0].reset();
}else{
alert(response.data);
}
},
error:function(xhr,status,error){
alert('返回数据异常!');
}
});
return false;
}
</script>