The error code SCRIPT5009 includes the following code: "jQuery" is undefined in IE9 (possibly also in older versions of IE):
var $tx; if (window.jQuery) { $tx = jQuery; if( jQuery().jquery.replace(".", "") < 17.1 ) { addjQuery(); } } else { addjQuery(); } function addjQuery() { document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"><\/script>'); document.write('<script type="text/javascript">$tx = jQuery.noConflict();<\/script>'); } document.write('<script src="workingScript.js"><\/script>');
I solved it! It works fine like this:
var $tx; if (window.jQuery) { $tx = jQuery; if( jQuery().jquery.replace(".", "") < 17.1 ) { addjQuery(); } } else { addjQuery(); } function addjQuery() { loadScript("http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", function(){ $tx = jQuery.noConflict(true); }); } document.write('<script src="workingScript.js"><\/script>'); function loadScript(url, callback){ var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState){
workingScript.js:
(function ($) {
The error here is: $ tx = jQuery.noConflict (); "if the addjQuery function is addjQuery . If the website is already using the current version of jQuery, erverythings works fine.
Does anyone have an idea how to solve this?
source share