jQuery: The Write Less, Do More JavaScript Library

Ticket #2020: 2020.diff

File 2020.diff, 1.0 kB (added by davidserduke, 8 months ago)

patch

  • src/ajax.js

     
    151151    lastModified: {}, 
    152152 
    153153    ajax: function( s ) { 
    154         var jsonp, jsre = /=(\?|%3F)/g, status, data; 
     154        var jsonp, jsre = /=(\?|%3F)(&|$)/g, status, data; 
    155155 
    156156        // Extend the settings, but re-extend 's' so that it can be 
    157157        // checked again later (in the test suite, specifically) 
     
    177177 
    178178            // Replace the =? sequence both in the query string and the data 
    179179            if ( s.data ) 
    180                 s.data = (s.data + "").replace(jsre, "=" + jsonp); 
    181             s.url = s.url.replace(jsre, "=" + jsonp); 
     180                s.data = (s.data + "").replace(jsre, "=" + jsonp + "$2"); 
     181            s.url = s.url.replace(jsre, "=" + jsonp + "$2"); 
    182182 
    183183            // We need to make sure 
    184184            // that a JSONP style response is executed properly 
     
    192192                // Garbage collect 
    193193                window[ jsonp ] = undefined; 
    194194                try{ delete window[ jsonp ]; } catch(e){} 
     195                if (head) 
     196                    head.removeChild( script ); 
    195197            }; 
    196198        } 
    197199