Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined request type in $.ajax #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cross-domain-ajax/jquery.xdomainajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jQuery.ajax = (function(_ajax){

var url = o.url;

if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
if ( (typeof o.type === 'undefined' || /get/i.test(o.type)) && !/json/i.test(o.dataType) && isExternal(url) ) {

// Manipulate options so that JSONP-x request is made to YQL

Expand Down Expand Up @@ -72,4 +72,4 @@ jQuery.ajax = (function(_ajax){

};

})(jQuery.ajax);
})(jQuery.ajax);
21 changes: 16 additions & 5 deletions cross-domain-ajax/test/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@


test('GET', function(){

expect(1);
stop();
asyncTest('GET', 1, function(){

jQuery.get('http://google.com', function(res){
ok(
Expand All @@ -13,4 +10,18 @@ test('GET', function(){
start();
});

});
});

asyncTest('Implicit GET', 1, function(){

jQuery.ajax({
url: 'http://yahoo.com',
success: function(res){
start();
ok(
!!(res && res.responseText),
'Implicit GET Request to Google.com succeeded!'
);
}
});
});