sweetalert

来源:互联网 发布:易视网络电视在线直播 编辑:程序博客网 时间:2024/06/06 16:30
<span style="font-size:14px;"> <ul class="examples">  <li class="message-html">     <div class="ui"><p>An HTML message</p><button>Try me!</button>     </div></li></ul><div>  <button  class="ss" id="xx">xxx</button></div> <script type="text/javascript" src="app/js/jquery-1.9.0.min.js "></script>    <script type="text/javascript" src="app/js/sweetalert/sweetalert-dev.js"></script>   <script>       document.querySelector("#xx").onclick = function(){   alert("adaf");swal({title: "HTML <small>Title</small>!",text: 'A custom <span style="color:#F8BB86">html<span> message.',html: true  });   };</span><pre name="code" class="html"><span style="font-size:14px;">      document.querySelector</span><span style="font-size:14px;">('ul.exaples li.message-html button').onclick = function(){</span><span style="font-size:14px;"></span><pre name="code" class="html"><span style="font-size:14px;">   alert("adaf");swal({title: "HTML <small>Title</small>!",text: 'A custom <span style="color:#F8BB86">html<span> message.',html: true  });   };</span>
 </script> 

ajax中怎么替换alert框
<form class="form-horizontal" role="form" id="userAddForm">
      。。。。                
</form>
$("#userAddForm").submit(function(e){
    
        e.preventDefault();
        data=$(this).serialize();
        var id = $("#room_number option:selected").val();
        $.ajax({
            "url" : "rest/user/"+id+"/addUser",
            "type" : "post",
            "dataType" : "text",
            "data" : data,
            "success":function(e){
               swal({
                title: "开户 <small>成功</small>!",
                text: 'A custom <span style="color:#F8BB86">success<span> message.',
                html: true
            });
            
            },
            "error" : function(e){
                alert("保存失败");
swal({
swal("Oops...", "Something went wrong!", "error");s
});
            }
        });
    });
    $("#cancel").click(function(e){
        location.href="rest/user/to_addUser";
    });
});


0 0
原创粉丝点击