2

我正在使用一个使用bootstrap-notify的模板,我想从一个视图向它发送数据:

try:
    # things
except Exception as e:
    options = {
                    "icon": "glyphicon glyphicon-warning-sign",
                    "title": "Bootstrap notify",
                    "message": "Turning standard Bootstrap alerts into 'notify' like notifications",
                    "url": "https://github.com/mouse0270/bootstrap-notify",
                    "target": "_blank"
                }
    return JsonResponse(options)

在此示例中,消息正在显示,但“图标”和“标题”等所有其他选项都被忽略。

在 JS 中,做同样的事情看起来像:

$.notify({
// options
message: 'Hello World' ,
title: 'your title'
},{
// settings
type: 'danger'
});​

关于如何解决这个问题的任何想法?

4

1 回答 1

0

你可以做类似的事情,让http://localhost:8000/notify-options/

$.get("http://localhost:8000/notify-options/", function(data, status){
    $.notify(data,{
        // settings
        type: 'danger'
    });​
});
于 2019-10-03T05:27:19.817 回答