This question is locked. New answers and comments are not allowed.
I'm new to JS/JSON and trying to put an app together but I am running into an issue parsing the returned JSON.
I am getting the data back from Everlive using Alert(JSON.Stringify(data)) but I cannot seem to get the syntax right when I try to parse the data to update the UI. If I set this.tankOwner.value to a literal it works (this.tankOwner.value = "SomeValue").
Thanks very much for any assistance
Code as follows:
_getTankByID: function(message) {
var filter = new Everlive.Query();
filter.where().eq('SerialNo', message);
var data = Everlive.$.data('Tank');
data.get(filter)
.then(function(data) {
// alert(JSON.stringify(data));
var tankResp = JQuery.parseJSON(data);
this.tankOwner.value = tankResp.TankOwner
},
function(error){
alert(JSON.stringify("Please Login"));
});
}
I am getting the data back from Everlive using Alert(JSON.Stringify(data)) but I cannot seem to get the syntax right when I try to parse the data to update the UI. If I set this.tankOwner.value to a literal it works (this.tankOwner.value = "SomeValue").
Thanks very much for any assistance
Code as follows:
_getTankByID: function(message) {
var filter = new Everlive.Query();
filter.where().eq('SerialNo', message);
var data = Everlive.$.data('Tank');
data.get(filter)
.then(function(data) {
// alert(JSON.stringify(data));
var tankResp = JQuery.parseJSON(data);
this.tankOwner.value = tankResp.TankOwner
},
function(error){
alert(JSON.stringify("Please Login"));
});
}