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:

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>
............ <-----Doesn't work with $manageusers::attempts either HTML Doc where number of logins is supposed to appear.
<p><h3><b>You have only <em id="logins"></em> login attempts left.</b> +</h3></p>

In reply to Cross-Origin Request Blocked by tultalk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.