Bootbox 指定引导框消息时我做错了什么,我';我出错了?
我正在使用此功能发送我正在更新用户权限级别的其他页面Bootbox 指定引导框消息时我做错了什么,我';我出错了?,bootbox,Bootbox,我正在使用此功能发送我正在更新用户权限级别的其他页面 var setPermLevel = function(userId, value) { $.ajax({ type: "POST", url: "/user/setPermLevel", data: {id: userId, value: value}, success: function(data)
var setPermLevel = function(userId, value)
{
$.ajax({
type: "POST",
url: "/user/setPermLevel",
data: {id: userId, value: value},
success: function(data)
{
if(data[0]['error']) bootbox.alert(data[0]['error']);
else bootbox.alert(data[0]['message'], function() { location.reload(); });
}
});
};
我正试图用这段代码将一条消息发送回bootbox以显示给用户,但我还是从bootbox收到一个错误“请指定一条消息”
if(isset($\u POST['id']))
{
$userId=$\u POST['id'];
$value=$_POST['value'];
$rslt=“[”;
if(User::isAdmin($\u会话['User'])<6&&$value>4){
$rslt.='{“错误”:“您无法访问它。”};
}
否则{
$q=DB::prepare('UPDATE`users`SET`Admin`=?其中`ID`=?');
$q->execute(数组($value,$userId));
$data.='{“消息”:“成功”}';
}
$rslt.=“]”;
echo$rslt;
}
这就是错误:
Uncaught Error: Please specify a message
at sanitize (bootbox.js:109)
at Object.window.bootbox.window.bootbox.exports.dialog (bootbox.js:450)
at Object.window.bootbox.window.bootbox.exports.alert (bootbox.js:246)
at Object.success (toolBox.js:3470)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest.<anonymous> (jquery.min.js:4)
未捕获错误:请指定一条消息
在清理时(bootbox.js:109)
位于Object.window.bootbox.window.bootbox.exports.dialog(bootbox.js:450)
位于Object.window.bootbox.window.bootbox.exports.alert(bootbox.js:246)
在Object.success(toolBox.js:3470)
at i(jquery.min.js:2)
在Object.fireWith[as resolveWith](jquery.min.js:2)
在A(jquery.min.js:4)
在XMLHttpRequest。(jquery.min.js:4)
我做错了什么,有人能帮我吗?
message
是一个必需的选项,因此第一步是将data[0]['error']
和data[0]['message']
回显到控制台(类似于console.log(data[0]['error']))
-如果这是一个空值或空值,您将看到错误。message
是一个必需选项,因此第一步是将data[0]['error']
和data[0]['message']
回显到控制台(类似于console.log(data[0]['error'])
-如果是空值或空值,您将看到错误。
Uncaught Error: Please specify a message
at sanitize (bootbox.js:109)
at Object.window.bootbox.window.bootbox.exports.dialog (bootbox.js:450)
at Object.window.bootbox.window.bootbox.exports.alert (bootbox.js:246)
at Object.success (toolBox.js:3470)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest.<anonymous> (jquery.min.js:4)