SCRIPT5009: “$” is undefined in IE7 & IE8

There is

SCRIPT5009: '$' is undefined

document.write("<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'><\/script>");

 var $jQueyobject = $;

with jQuery 1.10.2 in IE7 & IE8 . Why '$' is undefined in IE7 & IE8 ?

it working fine in chrome & FF

Thanks in advance

Answers


This is a 'security' feature, intended to stop script injection.

The workaround is to concatenate parts of the script tag string together. Try this:

document.write("<scr" + "ipt type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></scr" + "ipt>");

The newly created script tag is added after the script tag wherein you create the new one. Hence $ will be undefined. You need to separate your code into two script tags:

<script>
    document.write("<script...><\/script>");
</script>
<script>
    var $jQueyobject = $;
</script>

make sure all script loaded first and put it inside html tag.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
</head>
<body>
</body>
</html>

Need Your Help

Getting libstdc++-v3/python

c++ python svn download gdb

I am trying to download libstdc++-v3/python to enable pretty printing of stl containers. However, my provider returns: svn: Unknown hostname 'gcc.gnu.org' error. This is the command:

exception :Hibernate No configuration found

java hibernate caching orm ehcache

Application is trying to load ehcache.xml but could not find the file so then it loads ehcache-failsafe.xml. I would like to know does this cause any problem to application?