我正在调用一个使用回调的内部confirmDialog框,因为接下来发生的事情取决于用户的响应。这很好用。
confirmDialog('Record Locked', 'Record(s) locked by ' + locksheldby + 'Do you want to acquire record(s)', ConfirmRecordLocks);
function ConfirmRecordLocks(confirmed) {
console.log('what is confirmed', confirmed)
...
}
但与此同时,我希望传递一个包含已从数据库中检索的其他信息的对象,而无需再次获取它。我不想使用全局变量。这可能吗?
我发现的与其他参数相关的所有内容都适用于ajax。我尝试了一些我发现但没有运气的变种。第一个参数包含对象,但不包含用户的响应。第二个参数为空
confirmDialog('Record Locked', 'Record(s) locked by ' + locksheldby + '. Do you want to acquire record(s)?', function() { ConfirmRecordLocks(lockdata)});
function ConfirmRecordLocks(confirmed, lockdata) {
console.log('what is confirmed', confirmed)
console.log('what is lockdata', lockdata)
...
}
答案 0 :(得分:1)
你的意思:
confirmDialog('Record Locked', 'Record(s) locked by ' + locksheldby + '. Do you want to acquire record(s)?', function(confirmed) { ConfirmRecordLocks(confirmed, lockdata)});
function ConfirmRecordLocks(confirmed, lockdata) {
console.log('what is confirmed', confirmed)
console.log('what is lockdata', lockdata)
...
}