我想将参数从应用程序传递到适配器;我希望应用程序的用户输入这些选项。
现在我在适配器中传递这样的参数:
function getFeeds() {
WL.Logger.debug("inside method");
var input = {
method : 'get',
returnedContentType : 'json',
path : "ios/clientRegister.php",
parameters:{
"employeenumber":"500","employeename":"Harish","employeeemail":"anand5@gmail.com","city":"Delhi",
"employeeadID":"an6458","businessUnit":"WASE","country":"India","city":"Bengaluru","location":"EC4","bloodGroup":"B+ve", "gender":"Male","tShirt":"xl"
}
};
return WL.Server.invokeHttp(input);
}
答案 0 :(得分:1)
您可以使用简单的JavaScript传递参数 例如:
<强> HTML 强>
First name: <input type="text" id="firstname"/>
Last name: <input type="text" id="lastname"/>
<input type="button" onclick="submitName()" value="Submit Name"/>
App JS
function submitName() {
var invocationData = {
adapter : 'exampleAdapter',
procedure : "showParameters",
parameters : [$('#firstname').val(),$('#lastname').val()]
};
var options = {
onSuccess : success,
onFailure : failure
};
WL.Client.invokeProcedure(invocationData, options);
}
function success() {
alert ("success");
}
function failure() {
alert ("failure");
}
适配器XML
<procedure name="showParameters"/>
适配器实施
function showParameters(firstname, lastname) {
WL.Logger.info ("The submitted parameters are: '" + firstname + "' and '" + lastname + "'");
}
要实际查看记录的行,您需要:
Worklight Development Server
条目Server Configuration
Logging
将控制台日志级别从AUDIT
更改为INFO
(使用下拉列表)
您可能需要Project&gt;&gt;清洁...
结果将显示在Worklight Development Server的控制台视图中