Request is not working on demodb lazarus / 76-Pas2JS ---------------------------------------------------------------------- mangakissa · 2020-06-17 09:29 On $pas2js/demo/fcldb the're several examples to load data from a restserver. I compiled restserver and run it. It opens a console and start the server on port 3000. Then I load demodb in Lazarus and compile it with pas2js. After compiling I start demodb.html in my browser (firefox). It shows a button wit text 'fetch countries'. But the button doesn't work. I see nothing in the console of the restserver. If I do a request in my browser with url http://localhost:3000/countries the json file is loaded and showed on screen. That means restserver is running. Demorest is doing nothing. It doesn't show anything on screen. 'Data Abstract for Pas2JS' works. How do I get feetback from the restserver? ---------------------------------------------------------------------- mangakissa · 2020-06-17 09:47 This is what webconsole shows when clicking on the button: QuoteCross-Origin-aanvraag geblokkeerd: de Same Origin Policy staat het lezen van de externe bron op file:///C:/Users/john/Documents/Lazar us/projects/pasjs/demo/fcldb/countries.json niet toe. (Reden: CORS- aanvraag is geen http). Cross-Origin-request blokked: the Same Origin Policy is not allowed to load external source on file file:///C:/Users/john/Documents/Lazarus/p rojects/pasjs/demo/fcldb/countries.json ---------------------------------------------------------------------- mangakissa · 2020-06-17 10:22 changed Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xhr.open('GET', 'countries.json', true);toCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xhr.open('GET', 'http://localhost:3000/countries/', true); sends a request to the restserver. But this comes with an errormessage ---------------------------------------------------------------------- PascalDragon · 2020-06-17 11:23 Quote from: mangakissa on June 17, 2020, 11:47:27 amThis is what webconsole shows when clicking on the button: QuoteCross-Origin-aanvraag geblokkeerd: de Same Origin Policy staat het lezen van de externe bron op file:///C:/Users/john/Documents/Lazar us/projects/pasjs/demo/fcldb/countries.json niet toe. (Reden: CORS- aanvraag is geen http). Cross-Origin-request blokked: the Same Origin Policy is not allowed to load external source on file file:///C:/Users/john/Documents/Lazarus/p rojects/pasjs/demo/fcldb/countries.json Ah, right, I have installed myself an addon for my browser to temporary disable CORS for selected sites (in my case localhost), to avoid this problem. Quote from: mangakissa on June 17, 2020, 12:22:30 pmchanged Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xhr.open('GET', 'countries.json', true);toCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xhr.open('GET', 'http://localhost:3000/countries/', true); sends a request to the restserver. But this comes with an errormessage Ugh... what could that problem be again? ---------------------------------------------------------------------- mangakissa · 2020-06-17 11:38 There's an atachment with the message. ---------------------------------------------------------------------- PascalDragon · 2020-06-17 13:52 Quote from: mangakissa on June 17, 2020, 01:38:42 pmThere's an atachment with the message. Yes, I've seen that. Doesn't change my reply though, cause that was to that message...