十九、弹出框文字带超链接

来源:互联网 发布:oracle linux 启动命令 编辑:程序博客网 时间:2024/06/05 18:14

原因:弹出提示框,让用户先登录,才可以进行被保护的操作,想要提示框中的文档带超链接;
过程:
alert:实现不了,文字会原样展示
自定义alert:就想实现一个简单的功能,不想写太多代码
jquery ui dialog:简单,div中支持复杂的样式展示
html:

<div id="alertlogin" title="请先登陆">    <p><a href='/login?next={{ url_escape(request.uri) }}'>登陆</a>后,修改的数据才会保存</p></div>

js:

#先隐藏掉$('#alertlogin').hide();#ajax请求$.ajax({                async: false,                type: "get",                url: "/updateissue",                data: {                    'id': 1,                 },                success: function(data) {                    if (data['messge'] == "success") {                        alert("编辑成功");                    } else {                    #弹出提示框                        $("#alertlogin").dialog();                    }                    return false;                },                error: function() {                    alert("Error");                },                complete: function() {                }            });

引用文章:jQuery UI 实例 - 对话框(Dialog)
http://www.runoob.com/jqueryui/example-dialog.html

原创粉丝点击