jQuery: The Write Less, Do More JavaScript Library

Changeset 4106

Show
Ignore:
Timestamp:
12/11/07 20:16:19 (8 months ago)
Author:
davidserduke
Message:

Fix #1987 by only doing remote <script> type ajax with GET requests. All other types will be passed on to XMLHttpRequest.

Location:
trunk/jquery
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/ajax.js

    r4007 r4106  
    219219 
    220220        // If we're requesting a remote document 
    221         // and trying to load JSON or Script 
    222         if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) ) { 
     221        // and trying to load JSON or Script with a GET 
     222        if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) { 
    223223            var head = document.getElementsByTagName("head")[0]; 
    224224            var script = document.createElement("script"); 
  • trunk/jquery/test/unit/ajax.js

    r4059 r4106  
    574574}); 
    575575 
     576test("$.ajax() - script, Remote with POST", function() { 
     577    expect(3); 
     578 
     579    var base = window.location.href.replace(/\?.*$/, ""); 
     580 
     581    stop(); 
     582 
     583    $.ajax({ 
     584        url: base + "data/test.js", 
     585        type: "POST", 
     586        dataType: "script", 
     587        success: function(data, status){ 
     588            ok( foobar, "Script results returned (GET, no callback)" ); 
     589            equals( status, "success", "Script results returned (GET, no callback)" ); 
     590            start(); 
     591        } 
     592    }); 
     593}); 
     594 
    576595test("$.getJSON(String, Hash, Function) - JSON array", function() { 
    577596    expect(4);