This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Getting data from .lp script
#1
Hello guys,

I am preparing a few html pages but for saving memory I want prepare them fully on my PC and after tests I will upload them to LM.

Maybe somebody knows how can I connect my local page with lm .lp file?

I've tried something like this:
Code:
<!DOCTYPE html>
<html lang="en">
 <head>
   <meta charset="utf-8">
   <title>title</title>
   <script  src="https://code.jquery.com/jquery-3.2.1.min.js"  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="  crossorigin="anonymous"></script>
 </head>
 <body>
   
<script type="text/javascript">
$.get("LM_IP_ADDRESS/user/data.lp", function(data) {
 data = data.trim();
 data = JSON.parse(data);
 console.log(data);
});
</script>
</body>
</html>

But instead data I have nothing. And also no errorSad

I've also prepared some file which is a copy of a data which is generated via .lp file(json table) but then I have error:
~"Error in XML processing: syntax error" which is also very general error and I don't understand what is the problem .

The same is when I try only use $.get() for downloading very simple .txt and alert its source.
Reply
#2
Hi,

You need same origin policy for that and send extra header, but the server side must be handling that extra header and it's not prepared for that.

So you can't do what you want to do, you must run .html and .lp on the same origin..

Running .lp also on your local pc would require LUA and other stuff on your local server so i don't think you want to go there...

https://en.m.wikipedia.org/wiki/Same-origin_policy

BR,

Erwin
Reply
#3
(22.06.2017, 21:03)Erwin van der Zwart Wrote: Hi,

You need same origin policy for that and send extra header, but the server side must be handling that extra header and it's not prepared for that.

So you can't do what you want to do, you must run it on the same origin..

https://en.m.wikipedia.org/wiki/Same-origin_policy

BR,

Erwin

Also when I have in the same folder these 2 files:
- data.txt
- index.html.

And in index.html I am trying to download the content of data.txt? This is on the same folder. It is very strange for me Confused

I see also that Chrome has much precisely error description than Firefox.
Reply
#4
Hi,

Local files are not supported for protocol schemes, you need to run them from a webserver, you need to use something like a WAMP server for this.

BR,

Erwin
Reply
#5
Thanks ErwinWink
Reply


Forum Jump: