diff options
author | Simon Rettberg | 2019-07-19 22:00:53 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-19 22:00:53 +0200 |
commit | 79fe00fcb5143e5dce0bf06f1f49e5dc241e0979 (patch) | |
tree | 0dc5d82ac31a78a3e4b09111d481b15dc0322631 /script | |
parent | [locationinfo] increased cached date span for backends: dummy, davinci and ex... (diff) | |
download | slx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.tar.gz slx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.tar.xz slx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.zip |
slx-fixes.js: Make .cachedScript more compatible to .getScript
Allow passing a success callback directly
Diffstat (limited to 'script')
-rw-r--r-- | script/slx-fixes.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/script/slx-fixes.js b/script/slx-fixes.js index be35f56b..e8380702 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -108,11 +108,17 @@ $(document).ready(function() { }); // Caching script fetcher (https://api.jquery.com/jQuery.getScript/); use exactly like $.getScript -jQuery.cachedScript = function(url, options) { +jQuery.cachedScript = function(url, callback, options) { + if (!$.isFunction(callback)) { + options = callback; + callback = undefined; + } options = $.extend( options || {}, { + type: "get", dataType: "script", cache: true, - url: url + url: url, + success: callback }); return jQuery.ajax( options ); }; |