Reputation: 381
I am getting WL.JSONStore is undefined error in mobile browser simulator while I am trying to use JSONStore in my mobile application.I am using IBM mobilefirst (version 8.0.0-2017091111).
function wlCommonInit(){
WL.JSONStore.init(collections, options).then(function () {
alert("intialized successfully");
}).fail(function (errorObject) {
alert("failed to initialize collection\n"+ JSON.stringify(errorObject));
});
document.getElementById("btn_submit").addEventListener("click", onSubmit, false);
}
function onSubmit(){
var collectionName="people";
var data={firstName:$('#first').val(),middleName:$('#middle').val(),lastName:$('#last').val()};
WL.JSONStore.get(collectionName).add(data, options).then(function () {
alert("added data successfully");
}).fail(function (error) {
});
}
Upvotes: 0
Views: 505
Reputation: 2184
Add cordova jsonstore plugin
cordova plugin add cordova-plugin-mfp-jsonstore
https://www.npmjs.com/package/cordova-plugin-mfp-jsonstore
Upvotes: 0
Reputation: 606
Could you specify which version of 'cordova-plugin-mfp-jsonstore' your app is using (run command 'cordova plugin ls').
Did you follow this tutorial Link
Upvotes: 0