Problems finding the error! [closed]

0

I made a code and then I ran a scanner and it gave the code the site with a gap, I can not find where the error is and whether it is recorded or not. Here's the code:

var $K2 = jQuery.noConflict();

$K2(document).ready(function(){

  // Generic function to get URL params passed in .js script include
    function getUrlParams(targetScript, varName) {
        var scripts = document.getElementsByTagName('script');
        var scriptCount = scripts.length;
        for (var a = 0; a < scriptCount; a++) {
            var scriptSrc = scripts[a].src;
            if (scriptSrc.indexOf(targetScript) >= 0) {
                varName = varName.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
                var re = new RegExp("[\?&]" + varName + "=([^&#]*)");
                var parsedVariables = re.exec(scriptSrc);
                if (parsedVariables !== null) {
                    return parsedVariables[1];
                }
            }
        }
    }
    
asked by anonymous 03.03.2018 / 02:50

1 answer

-2

In the code you posted, you said a } key close at the end of the code to end the first function:

var $K2 = jQuery.noConflict();

$K2(document).ready(function(){

  // Generic function to get URL params passed in .js script include
    function getUrlParams(targetScript, varName) {
        var scripts = document.getElementsByTagName('script');
        var scriptCount = scripts.length;
        for (var a = 0; a < scriptCount; a++) {
            var scriptSrc = scripts[a].src;
            if (scriptSrc.indexOf(targetScript) >= 0) {
                varName = varName.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
                var re = new RegExp("[\?&]" + varName + "=([^&#]*)");
                var parsedVariables = re.exec(scriptSrc);
                if (parsedVariables !== null) {
                    return parsedVariables[1];
                }
            }
        }
    }
}); // Faltou
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    
03.03.2018 / 03:16