From fce2f77cb23aa09f4ccd391a0293ab41e0427695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Mon, 15 Jan 2018 00:07:14 +0100 Subject: [PATCH] add same id as value and name now it pops up because of app.js but does override somehow --- django/didgeridoo/currencies/views.py | 2 +- django/didgeridoo/static/js/app.js | 8 +++----- django/didgeridoo/webshop/templates/webshop/nav.html | 3 +++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/django/didgeridoo/currencies/views.py b/django/didgeridoo/currencies/views.py index 5e9b496..43c9d29 100644 --- a/django/didgeridoo/currencies/views.py +++ b/django/didgeridoo/currencies/views.py @@ -16,7 +16,7 @@ def currency_update(request): print('its get method') else: print('its not get method') - currency = request.GET.get('currency', None) + currency = request.GET.get('currency_update', None) data = ExchangeRate.objects.filter( name__name=currency).values( 'exchange_rate_to_chf').latest( diff --git a/django/didgeridoo/static/js/app.js b/django/didgeridoo/static/js/app.js index e9dea69..8bf833f 100644 --- a/django/didgeridoo/static/js/app.js +++ b/django/didgeridoo/static/js/app.js @@ -1,15 +1,13 @@ $("#currency_update").change(function () { - var currency = $(this).val(); + var currency_update = $(this).val(); $.ajax({ url: '/ajax/currency_update/', data: { - 'currency': currency + 'currency_update': currency_update }, dataType: 'json', success: function (data) { - if (data.is_taken) { - alert("es pop auf! --dies kommt von: static/js/app.js--."); - } + alert("es pop auf! --dies kommt von: static/js/app.js--.", data); } }); }); diff --git a/django/didgeridoo/webshop/templates/webshop/nav.html b/django/didgeridoo/webshop/templates/webshop/nav.html index f009520..bb3e269 100644 --- a/django/didgeridoo/webshop/templates/webshop/nav.html +++ b/django/didgeridoo/webshop/templates/webshop/nav.html @@ -28,6 +28,9 @@ +