Fixed #2174 by removing the s.dataType == "json" check for possible cross domain...
authorDavid Serduke <davidserduke@gmail.com>
Thu, 17 Jan 2008 21:38:58 +0000 (21:38 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Thu, 17 Jan 2008 21:38:58 +0000 (21:38 +0000)
src/ajax.js
test/unit/ajax.js

index 0f799fc..3e72488 100644 (file)
@@ -232,7 +232,7 @@ jQuery.extend({
 
                // If we're requesting a remote document
                // and trying to load JSON or Script with a GET
-               if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
+               if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" && s.type.toLowerCase() == "get" ) {
                        var head = document.getElementsByTagName("head")[0];
                        var script = document.createElement("script");
                        script.src = s.url;
index 8dcf759..15c4ed7 100644 (file)
@@ -649,15 +649,15 @@ test("$.getJSON(String, Function) - JSON object", function() {
        });
 });
 
-test("$.getJSON(String, Function) - Remote JSON object with assignment", function() {
+test("$.getJSON(String, Function) - JSON object with absolute url to local content", 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' );
+       $.getJSON(url(base + "data/json.php"), function(json) {
+         ok( json.data.lang == 'en', 'Check JSON: lang' );
+         ok( json.data.length == 25, 'Check JSON: length' );
          start();
        });
 });