I created a SQL adapter in worklight 6.1 with procedures for offline JSONStore.
I am able to call the adapter procedure using the below function, followed by execution of query.
But I am not able to make use of the invocation result.
function aa() {
try{
var result=WL.Client.invokeProcedure({
adapter : 'DB2',
procedure : 'getDB2',
parameters : [x,y]
invocationContext:{}
}, {
onSuccess : function(result) {
alert("login Success"); WL.Logger.debug("Retrieve success" + JSON.stringify(result));
//THIS IS NOT WORKING.I CANT SEE THE RESULT IN MY BROWSER
displayFeeds(result.invocationResult.resultSet);
document.getElementById("div4").innerHTML = result.invocationResult.resultSet[1].NAME;
},
onFailure : function(result){alert("login Failure");}
});
}
catch(e) {
alert("ERROR::"+e);
}
}
function displayFeeds(items){
var ul = $('#itemsList');
for (var i = 0; i < items.length; i++) {
var li = $('<li/>').html(items[i].PIN);
li.append($('<li/>').html(items[i].NAME));
li.append($('<li/>').html(items[i].DOB));
li.append($('<hr>'));
ul.append(li);
}
}
HTML:
...
...
<ul data-role="listview" id="itemsList" data-inset="true"> </ul>
<a href="#" data-role="button" id="button" onclick = "aa()">Show Name List</a>
<div id="div4"></div>