]> source.dussan.org Git - jquery.git/commitdiff
Fixed #1557, although it doesn't appear to be just an FF3 problem. In this case,...
authorDavid Serduke <davidserduke@gmail.com>
Thu, 29 Nov 2007 19:07:20 +0000 (19:07 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Thu, 29 Nov 2007 19:07:20 +0000 (19:07 +0000)
src/ajax.js
test/data/json_assigned_obj.js [new file with mode: 0644]
test/unit/ajax.js

index 8e7655cb922f97f22b14cc8c64361da7cb170fe6..6821cecc4bdc7e60ca4cebf404d8b7657ffe1aab 100644 (file)
@@ -217,7 +217,7 @@ jQuery.extend({
 
                // If we're requesting a remote document
                // and trying to load JSON or Script
-               if ( !s.url.indexOf("http") && s.dataType == "script" ) {
+               if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) ) {
                        var head = document.getElementsByTagName("head")[0];
                        var script = document.createElement("script");
                        script.src = s.url;
diff --git a/test/data/json_assigned_obj.js b/test/data/json_assigned_obj.js
new file mode 100644 (file)
index 0000000..867251d
--- /dev/null
@@ -0,0 +1 @@
+json_assigned_obj = { "test" : "worked" };
index 162650f3bec16c66239c10b6bcfd2ada05676d62..3e2ac9f2b7ae28c82904bb41a3c6c20c95ce8698 100644 (file)
@@ -513,6 +513,19 @@ test("$.getJSON(String, Function) - JSON object", function() {
        });
 });
 
+test("$.getJSON(String, Function) - Remote JSON object with assignment", function() {
+       expect(2);
+
+       var base = window.location.href.replace(/\?.*$/, "");
+
+       stop();
+       $.getJSON(base + "data/json_assigned_obj.js", function() {
+         ok( typeof json_assigned_obj == "object", 'Check JSON loaded' );
+         equals( json_assigned_obj.test, "worked", 'Check JSON obj.test' );
+         start();
+       });
+});
+
 test("$.post(String, Hash, Function) - simple with xml", function() {
        expect(4);
        stop();