How can i change the Value of a Service Settings per javascript?
How can i change the Value of a Service Settings per javascript?
It's a JavaScript array:
service_name['value'] = ...
I have a service called RSSservice and I want to set its URL to a value stored in a local storage variable but can't get it to work.
I get the required URL from one service and have the value mapped into a local variable. In the 'success' event (run javascript) I do this
RSSservice['URL']=localStorage.getItem('messagesContent');
In the same success event I then invoke the RSSservice and get the following error
GET https://appery.io/app/rest/tunnel 412 (Precondition Failed)
The local variable does contain the URL but presumably it isn't being set in the service.
What am I doing wrong?
Hello! You can change service settings
preRESTServiceName.__requestOptions.url = "http://newdomain.com";/pre
where RESTServiceName - service name in Services folder. URL will change for all services (on all pages) created based on this page.
2) You can change URL prerestserviceName.execute({"url":"http://newdomain.com"})/pre
restserviceName - service name on Data tab on specific page. URL will change only for this call. Other services won't change.
I have tried
RSSservice.execute({"url":localStorage.getItem('messagesContent')})
and get the following errors, if I put the same URL into 'settings' directly it works OK :-
OPTIONS http://www.safer-beds.org/rmwebportal... Origin http://appery.io is not allowed by Access-Control-Allow-Origin. jquery-1.8.2.js:8416
send jquery-1.8.2.js:8416
jQuery.extend.ajax jquery-1.8.2.js:7968
Appery.RestService.$t.createClass.process appery.js:1577
Appery.DataSource.$t.createClass.execute appery.js:1468
Appery.DataSource.onSuccess
Appery.DataSource.$t.createClass.successHandler appery.js:1373
Appery.DataSource.$t.createClass.responseDataHandler appery.js:1398
proxy jquery-1.8.2.js:775
fire jquery-1.8.2.js:974
self.fireWith jquery-1.8.2.js:1082
done jquery-1.8.2.js:7788
callback jquery-1.8.2.js:8500
XMLHttpRequest cannot load http://www.safer-beds.org/rmwebportal.... Origin http://appery.io is not allowed by Access-Control-Allow-Origin. /app/view/c1281a40-f1eb-4e52-aeca-47d8bbac1a28/messages.html:1
GET https://appery.io/app/rest/tunnel 412 (Precondition Failed) /app/rest/tunnel:1
This works OK as an .apk but not in test mode either through the Appery web test page or on the phone.
That's not a problem - thanks for your help.
Kevin,
Glad it's working! Thank you for the update.