jQuery.globalEval()

Execute some JavaScript code globally.

This method behaves differently from using a normal JavaScript eval() in that it's executed within the global context (which is important for loading external scripts dynamically).

version added: 1.0.4
code

The JavaScript code to execute.

Examples:

Execute a script in the global context.

function test() {
  jQuery.globalEval( "var newVar = true;" )
}
test();
// newVar === true
doc_jQuery
2016-03-27 13:48:34
Comments
Leave a Comment

Please login to continue.