// If we're requesting a remote document
// and trying to load JSON or Script with a GET
- if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
+ if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
test("$.getScript(String, Function) - with callback", function() {
expect(2);
stop();
+ window.foobar = null;
$.getScript(url("data/test.js"), function() {
equals( foobar, "bar", 'Check if script was evaluated' );
setTimeout(start, 100);
stop();
+ window.foobar = null;
$.ajax({
url: base + "data/test.js",
dataType: "script",
stop();
+ window.foobar = null;
$.ajax({
url: base + "data/test.js",
type: "POST",
});
});
+test("$.ajax() - script, Remote with scheme-less URL", function() {
+ expect(2);
+
+ var base = window.location.href.replace(/\?.*$/, "");
+ base = base.replace(/^.*?\/\//, "//");
+
+ stop();
+
+ window.foobar = null;
+ $.ajax({
+ url: base + "data/test.js",
+ dataType: "script",
+ success: function(data){
+ ok( foobar, "Script results returned (GET, no callback)" );
+ start();
+ }
+ });
+});
+
test("$.getJSON(String, Hash, Function) - JSON array", function() {
expect(4);
stop();