diff options
author | sgiehl <stefangiehl@gmail.com> | 2012-11-20 02:00:41 +0400 |
---|---|---|
committer | sgiehl <stefangiehl@gmail.com> | 2012-11-20 02:00:41 +0400 |
commit | 99793151cd6d4f318b7a011509bd421685f0537a (patch) | |
tree | 623b9521c3551d32d5eb808f57511ed38fe8e19a /plugins/UserCountry | |
parent | df1c54f0f7e50dfd670ab294d908e44ed4dbac44 (diff) |
refs #3359 moving ajax requests to a new ajax helper with more functionality as the old functions
git-svn-id: http://dev.piwik.org/svn/trunk@7489 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rwxr-xr-x | plugins/UserCountry/templates/admin.js | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/plugins/UserCountry/templates/admin.js b/plugins/UserCountry/templates/admin.js index efed733f06..8d10ca6e5c 100755 --- a/plugins/UserCountry/templates/admin.js +++ b/plugins/UserCountry/templates/admin.js @@ -13,14 +13,16 @@ $(document).ready(function() { var parent = $(this).parent(), loading = $('.loadingPiwik', parent), ajaxSuccess = $('.ajaxSuccess', parent); - loading.show(); - piwikHelper.ajaxCall( - 'UserCountry', - 'setCurrentLocationProvider', - {id: $(this).val()}, - function() { - loading.hide(); + var ajaxRequest = new ajaxHelper(); + ajaxRequest.setLoadingElement(loading); + ajaxRequest.addParams({ + module: 'UserCountry', + action: 'setCurrentLocationProvider', + id: $(this).val() + }, 'get'); + ajaxRequest.setCallback( + function () { ajaxSuccess.fadeIn(1000, function() { setTimeout(function() { ajaxSuccess.fadeOut(1000); @@ -28,6 +30,7 @@ $(document).ready(function() { }); } ); + ajaxRequest.send(false); }); // handle 'refresh location' link click @@ -39,18 +42,21 @@ $(document).ready(function() { location = $('.location', cell); location.css('visibility', 'hidden'); - loading.show(); - piwikHelper.ajaxCall( - 'UserCountry', - 'getLocationUsingProvider', - {id: $(this).attr('data-impl-id')}, - function(response) { - loading.hide(); + var ajaxRequest = new ajaxHelper(); + ajaxRequest.setLoadingElement(loading); + ajaxRequest.addParams({ + module: 'UserCountry', + action: 'getLocationUsingProvider', + id: $(this).attr('data-impl-id') + }, 'get'); + ajaxRequest.setCallback( + function (response) { location.html('<strong><em>' + response + '</em></strong>').css('visibility', 'visible'); - }, - 'html' + } ); + ajaxRequest.setFormat('html'); + ajaxRequest.send(false); return false; }); |