<form id="1fljn"></form>
      <address id="1fljn"></address>
        <form id="1fljn"><nobr id="1fljn"><th id="1fljn"></th></nobr></form>

              AB模板網(www.haitianjonas.com)專注企業網站模板制作,包括企業pbootcms網站模板,靜態網頁模板,網站源碼下載,HTML網站模板等等。+ 收藏我們

              網站模板

              網站模板搜索

              注冊

              PbootCMS使用Ajax無刷新提交留言及表單

              AB模板網 / 2021-10-11
              留言表單

              <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>

              Ajax提交

              <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>

              文章搜集與網絡,如有侵權請聯系本站,轉載請說明出處:http://www.haitianjonas.com/pbootcmsjs/9502.html

              有問題可以加入網站技術QQ群一起交流學習

              ☉首先聲明,只要是我們的vip會員全站所有資源均可以免費下載,不做任何限制(了解更多)

              ☉本站的源碼不會像其它下載站一樣植入大量的廣告。

              ☉本站提供的網站源碼,都是做好測試好發布的,均可放心使用。

              ☉本站提供的網站源碼,均帶數據及演示地址?梢栽谌我辉创a詳情頁查看演示地址。

              ☉為了vip利益的最大化,我們還提供了vip贈品(了解更多

              ☉如有其他問題,請加網站客服QQ(9490489)進行交流。

              首頁 pbootcms模板 html模板 會員中心
              中国一级毛片在公交车上

                  <form id="1fljn"></form>
                  <address id="1fljn"></address>
                    <form id="1fljn"><nobr id="1fljn"><th id="1fljn"></th></nobr></form>