tultalk has asked for the wisdom of the Perl Monks concerning the following question:
Hi: Testing accessing global variable in perl module from javascript in HTML page. I don't understand why it is seeing this as cross origin since both the requesting doc and the per module are in same program (namespace?) All the examples I found on search dealt with getting info from different sites. Errors. Firebug: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# insteadLearn More jquery-1.9.1.min.js:1 Object { 0: HTMLDocument → login_failed.htm, context: HTMLDocument → login_failed.htm, length: 1 } login_failed.htm:20:1 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://1.2.3.4/cserver/clientresptime?cid=CID5181430.AID1488339190.TID1770&url=http%3A%2F%2Fjala-mi.org/login_failed.htm%2F&resptime=198&starttime=1488420133137. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Perl Module:
............ <-----Doesn't work with $manageusers::attempts either HTML Doc where number of logins is supposed to appear.our $attempts = $session->param('attempts');<-Global variable # exported functions @EXPORT = qw(.....<--Global variable in list of exports $attempts HTML Doc javascript <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Login Failed Form</title> <meta name="robots" content="noindex, nofollow"> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> <script type="text/javascript"> var attempts = //#manageusers::attempts; <---- $(document).ready(function () { document.getElementById('logins').innerHTML= attempts; }); console.log(attempts); </script>
<p><h3><b>You have only <em id="logins"></em> login attempts left.</b> +</h3></p>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cross-Origin Request Blocked
by Corion (Patriarch) on Mar 02, 2017 at 14:16 UTC | |
by tultalk (Monk) on Mar 02, 2017 at 15:05 UTC | |
by Corion (Patriarch) on Mar 02, 2017 at 15:08 UTC | |
by tultalk (Monk) on Mar 02, 2017 at 15:59 UTC | |
by Corion (Patriarch) on Mar 02, 2017 at 16:03 UTC | |
by tultalk (Monk) on Mar 02, 2017 at 23:20 UTC | |
by Corion (Patriarch) on Mar 03, 2017 at 07:31 UTC | |
by huck (Prior) on Mar 02, 2017 at 23:57 UTC |