From 99793151cd6d4f318b7a011509bd421685f0537a Mon Sep 17 00:00:00 2001 From: sgiehl Date: Mon, 19 Nov 2012 22:00:41 +0000 Subject: 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 --- plugins/UserCountry/templates/admin.js | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'plugins/UserCountry') 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('' + response + '').css('visibility', 'visible'); - }, - 'html' + } ); + ajaxRequest.setFormat('html'); + ajaxRequest.send(false); return false; }); -- cgit v1.2.3