JavaScript Tutorial

jQuery.globalEval()

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>globalEval</title>
<script src="http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<script>
    var name = "Global variable";
    $(function () { 
            function test(){
            var name = "Local variable";
            alert(name); // local variables
            eval( "alert(name);" );// local variables
            $.globalEval( "alert(name);" );  // global variable
        }
        test();
    })
</script>
</body>
</html>