我有包含完整字段的“产品”表。我尝试在某些条件下查找并获取值。这是 javascript 文件
var APPLICATION_ID = "id",
SECRET_KEY = "key",
VERSION = "v1";
Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION);
function Products(args) {
args = args || {};
this.id_user = args.id_user || "";
this.cal = args.cal || null;
this.id_day = args.id_day || null;
this.id_product = args.id_product || null;
this.nameProduct = args.nameProduct || "";
}
var productStorage = Backendless.Persistence.of( Products );
var query = {
condition : "id_day = 33"
}
function get(){
try{
var product = productStorage.find(query).data;
}catch( e )
{
if( e.code != 1009 )
alert(e.message);
}
return [];
}
var array = get();
alert(array[0]);
在警报消息中,我得到的只是“未定义”。并且函数“get()”中的 catch 块也没有问题。