我试图将我的 ajax 调用返回的数据和其他代码放在一个函数中。
这是用于自定义 fckeditor 插件。
我有类似的东西
function customTag(editor){
var id = editor.config.id;
var instance = this;
//my custom ajax wrapper…….
//the 'dbData' is holding the returned data from ajax.
ajax.onFinished = function(dbData){ console.log(dbData)};
//I want to return this object and use my ajax returned data
return {
title:'Link',
minWidth : 200,
minHeight : 200,
buttons : [CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton],
contents: [
{
id:'tab',
label: 'test here',
elements: [
{
type:'select',
id:'select box',
//I want to use the returned data below
items: [[dbData[0],0],[dbData[1],0] ]
}
]
}
]
}
}
CKEDITOR.dialog.add('customTag', function(editor){
return customTag(editor);
});
我将如何解决这个问题。非常感谢!