通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
[TOC] ## form表单ajax 提交 ```js $(".js-ajax-form").submit(function(e){ e.preventDefault(); var data = $(this).serializeArray() var url = $(this).attr('action'); $.post(url,data,function(result){ if (result.code == 200){ alert(result.message); }else{ alert(result.message); } },'JSON'); }); ``` ## js-ajax-get ``` <a class="js-ajax-get" href="{:url('plinks/follow_chapter',['aid'=>$a['ji_no'],'nid'=>$books['id']])}">设为关注章节</a> $(document).ready(function(){ //无弹框 $('a.js-ajax-get').click(function(event){ event.preventDefault(); var url = $(this).attr('href'); $.getJSON(url,function(res){ if (res.code == 1) { alert("设置成功!"); window.location.reload(); } }); }); }) ``` ## js-ajax-get-dialog - 异步前弹出对话框 ``` <a class="js-ajax-get-dialog" href="{:url('plinks/follow_chapter',['aid'=>$a['ji_no'],'nid'=>$books['id']])}">设为关注章节</a> $('a.js-ajax-get-dialog').click(function(event){ event.preventDefault(); if (confirm("确认操作吗?")) { event.preventDefault(); var url = $(this).attr('href'); $.getJSON(url,function(res){ if (res.code == 1) { alert("设置成功!"); window.location.reload(); } }); } }); ```