<script>
//ajax提交留言,由于涉及到提交地址標(biāo)簽的解析,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("謝謝您的反饋,我們會(huì)盡快聯(lián)系您!");
$(obj)[0].reset();
}else{
alert(response.data);
}
},
error:function(xhr,status,error){
alert('返回?cái)?shù)據(jù)異常!');
}
});
return false;
}
</script>
|