in reply to Re: Cross-Origin Request Blocked
in thread Cross-Origin Request Blocked

Hi Took you suggestion on dealing with the dynamically created form. While investigating this issue module code to create form:

sub CreateLoginUserFailedForm { my ($message) = @_; print "Content-type: text/html \n\n"; print qq| $htmlInvalidLoginheader $htmlheader2 <!--$htmlheader3--> <!-- Dynamically created form from manage_users.cgi line 779--> <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>

Here is the same code after rendering to the browser: The var attempts is getting the count number from the global variable and increments each time the login fails. Take note of this: 1926 1926document as opposed to $(document The code

$(document).ready(function () { document.getElementById('logins').innerHTML= attempts;

Fails to execute

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>< +head><title>Invalid Login Data Feedback Form</title> <base href="http://www.jala-mi.org/"><meta http-equiv="Content-Type" c +ontent="text/html;charset=iso-8859-1"> <!--<link rel="StyleSheet" href="/css/jala.css" type="text/css">--> <!-- Dynamically created form from manage_users.cgi line 779--> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> <script type="text/javascript"> var attempts = 1; 1926 1926document).ready(function () { document.getElementById('logins').innerHTML= attempts; }); console.log(attempts); </script>

Replies are listed 'Best First'.
Re^3: Cross-Origin Request Blocked
by Corion (Patriarch) on Mar 03, 2017 at 07:31 UTC

    You're using double quotes, which interpolate Perl variables:

    print qq| $htmlInvalidLoginheader $htmlheader2 ... $(document).ready(function () { document.getElementById('logins').innerHTML= attempts; });

    I recommend that as a first step you split up the printing into the two parts - one part where you want Perl variables interpolated, and the other part where you output verbatim strings. Use single quotes for the second part. See also perlop.

    In the middle run, you should look at using one of the many templating systems instead.

Re^3: Cross-Origin Request Blocked
by huck (Prior) on Mar 02, 2017 at 23:57 UTC

    1926 1926document as opposed to $(document
    http://perldoc.perl.org/perlvar.html

    $(
    The real gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getgid() , and the subsequent ones by getgroups() , one of which may be the same as the first number.