简体   繁体   English

jQuery Bracket插件-函数结果中的init属性

[英]JQuery Bracket plugin - init property from a function result

I'm trying to initialize the render object with the result of a JS function that returns a query from a REST service 我正在尝试使用JS函数的结果初始化渲染对象,该函数从REST服务返回查询

JS function that returns a query from a REST service JS函数从REST服务返回查询

This is the function that initializes the object: 这是初始化对象的函数:

Function that initializes the object 初始化对象的函数

In the console log I have this result: 在控制台日志中,我得到以下结果:

Console log result 控制台日志结果

The expected result would be this :( 预期的结果是这样的:(

Expected result 预期结果

The problem was in assigning a variable within an asynchronous call. 问题在于在异步调用中分配变量。 I moved a call from the object's startup function to the success of the function calling the service and it worked. 我将调用从对象的启动函数移到了成功调用该服务的函数上,并且该函数可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM