Fixed #2174 by removing the s.dataType == "json" check for possible cross domain since it causes absolute urls to use a <script> tag ajax retrieval even though absolute urls work fine for retrieving local data. Cross-domain jsonp will still work since the $.ajax() function actually changes the s.dataType to "script" before it reaches this check in cases where it is s.dataType == "jsonp" or s.dataType == "json" and a parameter has =? in it.
This commit is contained in:
parent
dcb46c7fe5
commit
0635df4391
2 changed files with 5 additions and 5 deletions
|
@ -232,7 +232,7 @@ jQuery.extend({
|
||||||
|
|
||||||
// If we're requesting a remote document
|
// If we're requesting a remote document
|
||||||
// and trying to load JSON or Script with a GET
|
// 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 head = document.getElementsByTagName("head")[0];
|
||||||
var script = document.createElement("script");
|
var script = document.createElement("script");
|
||||||
script.src = s.url;
|
script.src = s.url;
|
||||||
|
|
|
@ -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);
|
expect(2);
|
||||||
|
|
||||||
var base = window.location.href.replace(/\?.*$/, "");
|
var base = window.location.href.replace(/\?.*$/, "");
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
$.getJSON(base + "data/json_assigned_obj.js", function() {
|
$.getJSON(url(base + "data/json.php"), function(json) {
|
||||||
ok( typeof json_assigned_obj == "object", 'Check JSON loaded' );
|
ok( json.data.lang == 'en', 'Check JSON: lang' );
|
||||||
equals( json_assigned_obj.test, "worked", 'Check JSON obj.test' );
|
ok( json.data.length == 25, 'Check JSON: length' );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue