Hi,
I am struggling with a Generic service that previously worked and that I built earlier this year.
I am loosing it in the condition where I put in: alert("script has been terminated");
Apparently the code does not go beyond
if (this.requestOptions.echo) {
settings.success(this.requestOptions.echo);
.....
Can you explain to me what this condition actually does? I am lost.
Thank you in advance.
Her is the code:
Appery.getOffline = Appery.createClass(null, {
init: function(requestOptions) {
this.__requestOptions = $.extend({}, requestOptions);
},
process: function(settings) {
if (this.requestOptions.echo) {
settings.success(this.requestOptions.echo);
alert("script has been terminated");
}
else {
// load JSON data from local storage
var cdata = localStorage.getItem("offline1");
var cdata3 = JSON.parse(cdata);
Code: Select all
//This is how the content of the local storage "offline1) looks like
//[{"PipelineSegment":"30566-3","CompanyName":"TAQA North Ltd."},{"PipelineSegment":"30566-8","CompanyName":"TAQA North Ltd."},{"PipelineSegment":"37397-1","CompanyName":"Crescent Point Energy Corp."},{"PipelineSegment":"37397-4","CompanyName":"Crescent Point Energy Corp."},{"PipelineSegment":"44372-1","CompanyName":"Anterra Energy Inc."},{"PipelineSegment":"47836-1","CompanyName":"Ridgeback Resources Inc."},{"PipelineSegment":"49783-1","CompanyName":"Enerplus Corporation"}]
// pass the JSON to the service, for output mapping
settings.success(cdata3);
}
settings.complete('success');
}
});