I'm throwing around an idea that I grab results from a webserver and display them on screen. As in,
I control the webcode too and can pass back simple text. I tried looking up some javascript to do
this but kept running into issues, especially since 99% of people aren't trying to pass back to a
BBS, and then thought to try here.
Not anything too fancy, I just want to grab text results and display them on the screen. What would
be the most direct route to do this?
I'm throwing around an idea that I grab results from a webserver and display them on screen. As in, I control the webcode too and can pass back simple text. I tried looking up some javascript to do this but kept running into issues, especially since 99% of people aren't trying to pass back to a BBS, and then thought to try here.
Not anything too fancy, I just want to grab text results and display them on the screen. What would be the most direct route to do this?
load('http.js');
var req = new HTTPRequest();
var res = req.Get('http://some.web.site/');
console.putmsg(res);
load('http.js');
var req = new HTTPRequest();
var res = req.Get('http://some.web.site/');
console.putmsg(res);
This is probably my javascript ignorance, but can I ask how you pass a javascript variable to a url
variable? I tried setting it to a complete string that displays correctly, but I get a 400 error
response from the server.
var res = req.Get(fullFormedURLThatWorksCopyPaste);
I also tried this -
var res = req.Get('http:///some.web.site/page?variable1=' + variable1);
Re: Grabbing results from a webpage
By: echicken to The Lizard Master on Thu Jul 23 2020 09:14 am
> load('http.js');
> var req = new HTTPRequest();
> var res = req.Get('http://some.web.site/');
> console.putmsg(res);
This is probably my javascript ignorance, but can I ask how you pass a javascript variable to a url variable? I tried setting it to a complete string that displays correctly, but I get a 400 error response from the server.
var res = req.Get(fullFormedURLThatWorksCopyPaste);
I also tried this -
var res = req.Get('http:///some.web.site/page?variable1=' + variable1);
var res = req.Get('http:///some.web.site/page?variable1=' + encodeURIComponent(variable1))
If encodeURIComponent isn't available, use escape
As long as variable1 is a string (or a type that will become a string as needed, but that's a whole other topic). And remove that extra slash near the beginning.
req.Get('http://some.web.site/page?variable1=' + 'some_string');
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,044 |
Nodes: | 16 (1 / 15) |
Uptime: | 45:31:29 |
Calls: | 500,942 |
Calls today: | 5 |
Files: | 109,374 |
D/L today: |
5,255 files (1,003M bytes) |
Messages: | 304,050 |