This turns out to be pretty easy.
First, you’ll need to reformat the data on the server a bit and rename
Contents of the file:
Call it whatever you like – in my sample, it’s data.js.
Here’s the code in an NS Basic/App Studio program:
'GetData - gets some data from a remote site and processes it
head = document.getElementsByTagName("head")
newScript = document.createElement("script")
newScript.src = "http://www.nsbasic.com/data.js"
For i=0 To UBound(data)-1
Textarea1.value=Textarea1.value & data(i) & vbcrlf
The data in data.js is actually a mini program: it calls a function called processData with the data you want to download.
In the above code, Button1_onclick() takes that file, inserts it into your program and executes it. The code in the file calls processData, which interprets the incoming data and, in this case, simply displays it.
You’ll have to take care that no one can modify data.js, or they could
have all kinds of fun!
This sample will be included in the next build.