diff --git a/src/EventManager.js b/src/EventManager.js index e05ca9c..a171a39 100644 --- a/src/EventManager.js +++ b/src/EventManager.js @@ -136,13 +136,22 @@ function EventManager(options, _sources) { var success = source.success; var error = source.error; var complete = source.complete; - var custom_data; + + // retrieve any outbound GET/POST $.ajax data from the options + var customData; if ($.isFunction(source.data)) { - custom_data = source.data(); - } else { - custom_data = source.data; + // supplied as a function that returns a key/value object + customData = source.data(); } - var data = $.extend({}, custom_data || {}); + else { + // supplied as a straight key/value object + customData = source.data; + } + + // use a copy of the custom data so we can modify the parameters + // and not affect the passed-in object. + var data = $.extend({}, customData || {}); + var startParam = firstDefined(source.startParam, options.startParam); var endParam = firstDefined(source.endParam, options.endParam); if (startParam) { @@ -151,6 +160,7 @@ function EventManager(options, _sources) { if (endParam) { data[endParam] = Math.round(+rangeEnd / 1000); } + pushLoading(); $.ajax($.extend({}, ajaxDefaults, source, { data: data,