我正在尝试在Mobilefirst 8.0中调用WL worklight方法。但没有一种方法可以调用。我已经尝试了WLResourceRequest,WL.Client.Environment等来调用适配器方法。 代码段:
alert("Calling adapter"); //printed
var url = "/adapters/AdapterNewGet/getFeed1";
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);
alert("Called adapter"); //Not Printed
此处,alert("Called adapter");
未执行。如果我必须包含一些worklight库或需要进行一些设置,请告诉我。
答案 0 :(得分:0)
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);
这只会初始化WLResourceRequest
对象。您必须致电resourceRequest.send()
才能实际呼叫服务器。
alert("Calling adapter"); //printed
var url = "/adapters/AdapterNewGet/getFeed1";
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);
resourceRequest.send().then(onSuccess,onFailure);
// Move the below line to your onSuccess.
// Add similar error handling in the onFailure
alert("Called adapter"); //Not Printed