前段时间做项目的时候写的一段代码,感觉挺实用,记录下来分享给大家

复制代码 代码如下:
<a class="btn_fankui relative" id="btn_fankui" style="top:7px;">
        <div class="qr_content" id="fankui_1" style="top:40px; left:-25px;">
         <span></span>
         <form class="fankui_form" action=""> 
                <table>
    <caption>发送文章到手机</caption>
    
                 <tr>
                  <td align="right" valign="middle"><label for="mphno">手机号</label></td>
                   <td><input class="input" name="mphno" type="text" id="input_phone"/></td>
                  </tr>
      <tr id="p_memssage">
     
                  </tr>
                 <tr>
                   <td colspan="2" align="right" id="short_d"><input name="" type="button" class="fankui_tijiao" value="提&nbsp;交"/></td>
                   <td colspan="2" align="center" id="short_n" style="display:none">请稍等</td>
                  </tr>
                </table>
          </form>
        </div>
        </a>
   <script type="text/javascript">
                $("#btn_fankui").toggle(function(){
                    $("#fankui_1").fadeIn(1);},
                function(){
                    $("#fankui_1").fadeOut(1);});
                     $("#fankui_1").click(function(e){e.stopPropagation();});
    $(".fankui_tijiao").click(function(){
     var phone = $("#input_phone").val();
     var content = "您订阅的文章{$title}地址是:{$url}";
     var p1 = /^((\(\d{3}\))|(\d{3}\-))"#p_memssage").html("");
      $.ajax({
       url:"{APP_PATH}index.php",
       type:"POST",
       dataType:"html",
       data:{
        "id":"{$id}",
        "mobile":phone,
        "content":"您订阅的文章《{$title}》地址是:{$url}",
        "rip":"{php echo ip()}",
       },
       error:function(data1,data2){
        alert(data2);
        alert("提交出错!请稍后重试!");
       },
       beforeSend:function(){
        $("#short_d").hide();
        $("#short_n").css("display","block");
       },
       success:function(data){
        $("#fankui_1").css("display","none");
        $("#short_d").show();
        $("#short_n").css("display","none");
        alert(data);
       }
      });
       
     }else{
      $("#p_memssage").html("<td colspan='2'><center><font color='red'>请正确填写你的手机号</font></center></td>");
      return false;
     }
    });
    $("#fankui_2").click(function(){
     $(this).hide();
    })
            </script>

标签:
jQuery,发送文章到手机

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“基于jquery实现发送文章到手机的代码”

暂无“基于jquery实现发送文章到手机的代码”评论...