Permalink
Browse files

Updated builds.

1 parent d7c8625 commit 0d411f761c26013fb8f960d5a0a20f848706fdc5 jfh committed Sep 25, 2011
Showing with 19 additions and 6 deletions.
  1. +18 −5 build/dist/jquery.jfeed.js
  2. +1 −1 build/dist/jquery.jfeed.pack.js
View
@@ -12,13 +12,27 @@ jQuery.getFeed = function(options) {
data: null,
cache: true,
success: null,
- failure: null
+ failure: null,
+ error: null,
+ global: true
}, options);
if (options.url) {
+
+ if (jQuery.isFunction(options.failure) && jQuery.type(options.error)==='null') {
+ // Handle legacy failure option
+ options.error = function(xhr, msg, e){
+ options.failure(msg, e);
+ }
+ } else if (jQuery.type(options.failure) === jQuery.type(options.error) === 'null') {
+ // Default error behavior if failure & error both unspecified
+ options.error = function(xhr, msg, e){
+ window.console&&console.log('getFeed failed to load feed', xhr, msg, e);
+ }
+ }
- $.ajax({
+ return $.ajax({
type: 'GET',
url: options.url,
data: options.data,
@@ -28,9 +42,8 @@ jQuery.getFeed = function(options) {
var feed = new JFeed(xml);
if (jQuery.isFunction(options.success)) options.success(feed);
},
- error: function (xhr, msg, e) {
- if (jQuery.isFunction(options.failure)) options.failure(msg, e);
- }
+ error: options.error,
+ global: options.global
});
}
};

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 0d411f7

Please sign in to comment.