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: | Coz |
---|---|
Location: | Anoka, MN |
Users: | 2 |
Nodes: | 4 (0 / 4) |
Uptime: | 140:33:51 |
Calls: | 166 |
Files: | 5,389 |
Messages: | 223,239 |