我正在使用一个使用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)在此示例中,显示了消息,但忽略了所有其他选项,如"icon“和"title”。
在JS中,做同样的事情看起来像这样:
$.notify({
// options
message: 'Hello World' ,
title: 'your title'
},{
// settings
type: 'danger'
});有什么办法解决这个问题吗?
发布于 2019-10-03 13:27:20
你可以这样做,让http://localhost:8000/notify-options/
$.get("http://localhost:8000/notify-options/", function(data, status){
$.notify(data,{
// settings
type: 'danger'
});
});https://stackoverflow.com/questions/58084362
复制相似问题