Another attempt to fix the getScript problem
[jquery.git] / src / ajax / ajax.js
index b8ccdd6..f0f448a 100644 (file)
@@ -123,8 +123,9 @@ jQuery.fn.extend({
                        if ( this.src )
                                // for some weird reason, it doesn't work if the callback is ommited
                                jQuery.getScript( this.src );
-                       else
-                               eval.call( window, this.text || this.textContent || this.innerHTML || "" );
+                       else {
+                               jQuery.eval ( this.text || this.textContent || this.innerHTML || "" );
+                       }
                }).end();
        }
 
@@ -681,12 +682,9 @@ jQuery.extend({
                var data = !type && ct && ct.indexOf("xml") >= 0;
                data = type == "xml" || data ? r.responseXML : r.responseText;
 
-               // If the type is "script", eval it´in global context
+               // If the type is "script", eval it in global context
                if ( type == "script" ) {
-                       if (window.execScript)
-                               window.execScript( data );
-                       else
-                               window.setTimeout( data, 0 );
+                       jQuery.eval( data );
                }
 
                // Get the JavaScript object, if JSON is used.
@@ -727,6 +725,14 @@ jQuery.extend({
 
                // Return the resulting serialization
                return s.join("&");
+       },
+       
+       // TODO document me
+       eval: function(data) {
+               if (window.execScript)
+                       window.execScript( data );
+               else
+                       eval.call( window, data );
        }
 
 });