aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2006-11-20 20:37:28 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2006-11-20 20:37:28 +0000
commit46faa03820f82e5b03e6b3d73bd9d5b194b2b310 (patch)
tree91ea82c426afe96b27222e1aef17ba0b93a04379 /src/ajax
parent7cc550727c4e0bcd93c5d435f0799f568fc74dfa (diff)
downloadjquery-46faa03820f82e5b03e6b3d73bd9d5b194b2b310.tar.gz
jquery-46faa03820f82e5b03e6b3d73bd9d5b194b2b310.zip
Fix for bug #407, yet to be tested
Diffstat (limited to 'src/ajax')
-rw-r--r--src/ajax/ajax.js18
-rw-r--r--src/ajax/ajaxTest.js2
2 files changed, 14 insertions, 6 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index e5a3854cf..b8ccdd652 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -122,7 +122,7 @@ jQuery.fn.extend({
return this.find('script').each(function(){
if ( this.src )
// for some weird reason, it doesn't work if the callback is ommited
- jQuery.getScript( this.src, function() {} );
+ jQuery.getScript( this.src );
else
eval.call( window, this.text || this.textContent || this.innerHTML || "" );
}).end();
@@ -581,9 +581,12 @@ jQuery.extend({
if ( s.ifModified && modRes )
jQuery.lastModified[s.url] = modRes;
- // If a local callback was specified, fire it
+ // process the data (runs the xml through httpData regardless of callback)
+ var data = jQuery.httpData( xml, s.dataType );
+
+ // If a local callback was specified, fire it and pass it the data
if ( s.success )
- s.success( jQuery.httpData( xml, s.dataType ), status );
+ s.success( data, status );
// Fire the global callback
if( s.global )
@@ -678,8 +681,13 @@ 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
- if ( type == "script" ) eval.call( window, data );
+ // If the type is "script", eval it´in global context
+ if ( type == "script" ) {
+ if (window.execScript)
+ window.execScript( data );
+ else
+ window.setTimeout( data, 0 );
+ }
// Get the JavaScript object, if JSON is used.
if ( type == "json" ) eval( "data = " + data );
diff --git a/src/ajax/ajaxTest.js b/src/ajax/ajaxTest.js
index 0462aadcd..ba5d4a46d 100644
--- a/src/ajax/ajaxTest.js
+++ b/src/ajax/ajaxTest.js
@@ -119,7 +119,7 @@ test("$.getScript(String, Function) - with callback", function() {
stop();
$.getScript("data/test.js", function() {
ok( foobar == "bar", 'Check if script was evaluated' );
- start();
+ setTimeout(start, 100);
});
});