I have build a backend with sails.js+waterline
get data like :http://127.0.0.1:1337/App_Dist/A1a
and i change the sample JSON3 to test the data
SimpleGet "App/files/data.json" "[Data]" --->SimpleGet "127.0.0.1:1337/App_Dist/A1a" "[Data]"
HtmlContent1:
but while i click the button,the data not show up....
Hello Joshua,
Try to change the URL from "127.0.0.1:1337/App_Dist/A1a" to "http://127.0.0.1:1337/App_Dist/A1a". Note the "http://" first. I am not sure if this is the problem, but you can try it. On the other hand, assert the problem is not related with "CORS": remember we must allow "CORS" in our server script in order to accept our app's requests.
Take a look here http://enable-cors.org/ and finally tell me if this can help you in some way!
P.S. Try also to run the application in Firefox with the Developer tools open (press F12 in Firefox)... maybe we can get a little more information about the cause of the problem.
change the URL from "127.0.0.1:1337/App_Dist/A1a" to "http://127.0.0.1:1337/App_Dist/A1a"
and set the config in sails ,cors.js
in firefox F12 still get error like this:
The token 'cache-control' is invalid, From CORS header 'Access-Control-Allow-Headers' from CORS preflight channel
Hello Joshua,
You must to allow the "cache-control" header for "CORS" requests. Here is how we can enable "CORS" from a particular PHP script, maybe this can help you in some way:
And here is how we enable "CORS" from an "htaccess" file for the Apache server:
after change the config file (cors.js) in sail.js to below:
FireFox F12 show no error,but the value still not show up!
I finally found out that :
the data would not show up ,if they are like this:
but the data would show up ,if they are like this:
Hello Joshua,
Sorry for the delay. I expend all the day into the hospital with my mom. About your last post, certainly the first one is an "Array" which contains an "Object". So probably the data is ready, but inside the "Array" and not directly as in the second sample code, because this last yes, is an "Object" alone and not inside any "Array".
Remember App Builder have actions for both "Arrays" and "Objects", then, if you really wanted, you can access to the first "Array" in order to extract the "Object".
Thanks for your respond,please give my best wishes to your mom,always family first right!?
this is the code:
and i can get the data show up,but just need to click the Button twice..
please take your time,i can wait
Hello Joshua,
Thanks for your kindly words. The above code is not completely correct, because "SimpleGet" is executed asynchronously, that is, the next action is executed probably without having a response from the server.
The "SimpleGet" action can be good, but not in this context. So what we can do? Use the HttpClient control instead, and extract the "response object" on the HttpClient control's Success event.
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.