gpt4 book ai didi

javascript - 从后端代码发送数据到 bootstrap-notify

转载 作者:行者123 更新时间:2023-11-30 06:12:25 27 4
gpt4 key购买 nike

我使用的模板使用 bootstrap-notify我想从一个 View 向它发送数据:

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'
});​

知道如何解决这个问题吗?

最佳答案

你可以这样做,让 http://localhost:8000/notify-options/

$.get("http://localhost:8000/notify-options/", function(data, status){
$.notify(data,{
// settings
type: 'danger'
});​
});

关于javascript - 从后端代码发送数据到 bootstrap-notify,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58084362/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com