From fb119cc208fd286e4eb905e4d8bc26e213e7c62a Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 4 Feb 2016 07:30:12 +0100 Subject: [PATCH] Replaced success() with done () --- public/js/budgets.js | 2 +- public/js/charts.js | 10 +++++----- public/js/firefly.js | 2 +- public/js/help.js | 2 +- public/js/index.js | 4 ++-- public/js/piggy-banks/index.js | 2 +- public/js/reports/default/reports.js | 2 +- public/js/rules/create-edit.js | 4 ++-- public/js/transactions/create-edit.js | 10 +++++----- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/public/js/budgets.js b/public/js/budgets.js index 635942d1df..c8ca145734 100644 --- a/public/js/budgets.js +++ b/public/js/budgets.js @@ -62,7 +62,7 @@ function updateBudgetedAmounts(e) { drawBudgetedBar(); // send a post to Firefly to update the amount: - $.post('budgets/amount/' + id, {amount: value, _token: token}).success(function (data) { + $.post('budgets/amount/' + id, {amount: value, _token: token}).done(function (data) { // update the link if relevant: if (data.repetition > 0) { $('.budget-link[data-id="' + id + '"]').attr('href', 'budgets/show/' + id + '/' + data.repetition); diff --git a/public/js/charts.js b/public/js/charts.js index b4ad2736c9..5b3ce5fcc3 100644 --- a/public/js/charts.js +++ b/public/js/charts.js @@ -136,7 +136,7 @@ var defaultStackedColumnOptions = { */ function lineChart(URL, container, options) { "use strict"; - $.getJSON(URL).success(function (data) { + $.getJSON(URL).done(function (data) { var ctx = document.getElementById(container).getContext("2d"); var newData = {}; newData.datasets = []; @@ -170,7 +170,7 @@ function lineChart(URL, container, options) { function areaChart(URL, container, options) { "use strict"; - $.getJSON(URL).success(function (data) { + $.getJSON(URL).done(function (data) { var ctx = document.getElementById(container).getContext("2d"); var newData = {}; newData.datasets = []; @@ -206,7 +206,7 @@ function columnChart(URL, container, options) { options = options || {}; - $.getJSON(URL).success(function (data) { + $.getJSON(URL).done(function (data) { var result = true; if (options.beforeDraw) { @@ -252,7 +252,7 @@ function stackedColumnChart(URL, container, options) { options = options || {}; - $.getJSON(URL).success(function (data) { + $.getJSON(URL).done(function (data) { var result = true; if (options.beforeDraw) { @@ -295,7 +295,7 @@ function stackedColumnChart(URL, container, options) { function pieChart(URL, container, options) { "use strict"; - $.getJSON(URL).success(function (data) { + $.getJSON(URL).done(function (data) { var ctx = document.getElementById(container).getContext("2d"); new Chart(ctx).Pie(data, defaultPieOptions); diff --git a/public/js/firefly.js b/public/js/firefly.js index 019726a578..3130714722 100644 --- a/public/js/firefly.js +++ b/public/js/firefly.js @@ -47,7 +47,7 @@ $(function () { end: end.format('YYYY-MM-DD'), label: label, _token: token - }).success(function () { + }).done(function () { console.log('Succesfully sent new date range.'); window.location.reload(true); }).fail(function () { diff --git a/public/js/help.js b/public/js/help.js index fab1272029..e5d8fc59ae 100644 --- a/public/js/help.js +++ b/public/js/help.js @@ -16,7 +16,7 @@ function showHelp(e) { $('#helpTitle').html('Please hold...'); $('#helpModal').modal('show'); - $.getJSON('help/' + encodeURI(route)).success(function (data) { + $.getJSON('help/' + encodeURI(route)).done(function (data) { $('#helpBody').html(data.text); $('#helpTitle').html(data.title); }).fail(function () { diff --git a/public/js/index.js b/public/js/index.js index 87bae2bf0f..faeed6f099 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -5,7 +5,7 @@ $(function () { // do chart JS stuff. drawChart(); if (showTour) { - $.getJSON('json/tour').success(function (data) { + $.getJSON('json/tour').done(function (data) { var tour = new Tour( { steps: data.steps, @@ -70,7 +70,7 @@ function getBoxAmounts() { var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid']; for (var x in boxes) { var box = boxes[x]; - $.getJSON('json/box/' + box).success(putData).fail(failData); + $.getJSON('json/box/' + box).done(putData).fail(failData); } } diff --git a/public/js/piggy-banks/index.js b/public/js/piggy-banks/index.js index 9c2464df39..9fa00d2375 100644 --- a/public/js/piggy-banks/index.js +++ b/public/js/piggy-banks/index.js @@ -79,7 +79,7 @@ function stopSorting() { var id = holder.data('id'); order.push(id); }); - $.post('/piggy-banks/sort', {_token: token, order: order}).success(function () { + $.post('/piggy-banks/sort', {_token: token, order: order}).done(function () { $('.loadSpin').removeClass('fa fa-refresh fa-spin'); }); } \ No newline at end of file diff --git a/public/js/reports/default/reports.js b/public/js/reports/default/reports.js index 23adac5fcd..8e7721e75b 100644 --- a/public/js/reports/default/reports.js +++ b/public/js/reports/default/reports.js @@ -126,7 +126,7 @@ function openModal(e) { var target = $(e.target).parent(); var URL = target.attr('href'); - $.get(URL).success(function (data) { + $.get(URL).done(function (data) { $('#defaultModal').empty().html(data).modal('show'); }).fail(function () { diff --git a/public/js/rules/create-edit.js b/public/js/rules/create-edit.js index 13c4027f10..3434bcd851 100644 --- a/public/js/rules/create-edit.js +++ b/public/js/rules/create-edit.js @@ -20,7 +20,7 @@ function addNewTrigger() { "use strict"; triggerCount++; - $.getJSON('json/trigger', {count: triggerCount}).success(function (data) { + $.getJSON('json/trigger', {count: triggerCount}).done(function (data) { //console.log(data.html); $('tbody.rule-trigger-tbody').append(data.html); }).fail(function () { @@ -32,7 +32,7 @@ function addNewAction() { "use strict"; actionCount++; - $.getJSON('json/action', {count: actionCount}).success(function (data) { + $.getJSON('json/action', {count: actionCount}).done(function (data) { //console.log(data.html); $('tbody.rule-action-tbody').append(data.html); }).fail(function () { diff --git a/public/js/transactions/create-edit.js b/public/js/transactions/create-edit.js index 974a2b14de..9adef04a04 100644 --- a/public/js/transactions/create-edit.js +++ b/public/js/transactions/create-edit.js @@ -9,13 +9,13 @@ $(document).ready(function () { "use strict"; if ($('input[name="expense_account"]').length > 0) { - $.getJSON('json/expense-accounts').success(function (data) { + $.getJSON('json/expense-accounts').done(function (data) { $('input[name="expense_account"]').typeahead({source: data}); }); } if ($('input[name="tags"]').length > 0) { - $.getJSON('json/tags').success(function (data) { + $.getJSON('json/tags').done(function (data) { var opt = { typeahead: { source: data @@ -28,19 +28,19 @@ $(document).ready(function () { } if ($('input[name="revenue_account"]').length > 0) { - $.getJSON('json/revenue-accounts').success(function (data) { + $.getJSON('json/revenue-accounts').done(function (data) { $('input[name="revenue_account"]').typeahead({source: data}); }); } if ($('input[name="description"]').length > 0 && what !== undefined) { - $.getJSON('json/transaction-journals/' + what).success(function (data) { + $.getJSON('json/transaction-journals/' + what).done(function (data) { $('input[name="description"]').typeahead({source: data}); }); } if ($('input[name="category"]').length > 0) { - $.getJSON('json/categories').success(function (data) { + $.getJSON('json/categories').done(function (data) { $('input[name="category"]').typeahead({source: data}); }); }