
AB模板網(wǎng)(www.gdouyate.com)專注企業(yè)網(wǎng)站模板制作,包括企業(yè)pbootcms網(wǎng)站模板,靜態(tài)網(wǎng)頁模板,網(wǎng)站源碼下載,HTML網(wǎng)站模板等等。XML地圖 網(wǎng)站地圖 今日更新
免責聲明:本站所有資源(模板、圖片)搜集整理于互聯(lián)網(wǎng)或者網(wǎng)友提供,僅供學習與交流使用,如果不小心侵犯到你的權(quán)益,請及時聯(lián)系我們刪除該資源。
<form onsubmit="return submsg(this);"> 聯(lián)系人<input type="text" name="contacts" required id="contacts"> 手 機<input type="text" name="mobile" required id="mobile"> 內(nèi) 容<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("謝謝您的反饋,我們會盡快聯(lián)系您!"); $(obj)[0].reset(); }else{ alert(response.data); } }, error:function(xhr,status,error){ alert('返回數(shù)據(jù)異常!'); } }); return false; } </script> |