9
我有问题试图获取选定的对象,而不是传递给成功回调的“newValue”。X-Editable JQuery插件 - 选择获取源对象
下面是一个例子:
$("select").editable({
type : "select",
title: 'Select Fruit',
source : [
{text : "Apple", value: "option_1"},
{text : "Orange", value: "option_2"},
{text : "Mango",value: "option_3"},
{text : "Strawberry",value: "option_4"}
],
success:function(response,newValue){
console.log(newValue); // newValue contains the "text" string ok..
// How do I get the selected source object? eg. {text : "Orange", value: "option_2"}
// So I can access the object like..
console.log(newValue.value); // output option_*
}
});
感谢 卡尔
你有没有看到console.log(响应)? – MVG1984
是的,我已经尝试过,这是来自Ajax请求(我没有使用)的响应 –
@CarlSmith可以为此做一个小提琴吗? – ProllyGeek