From 6f50a4c1a9e105a13195eedb55f357aa0c810877 Mon Sep 17 00:00:00 2001 From: Divlo Date: Wed, 28 Aug 2019 13:41:26 +0200 Subject: [PATCH] weatherRequest execution in weatherRequest.php --- .gitignore | 4 +--- incl/footer.php | 2 +- scripts/main.js | 29 ++++++------------------- views/function-views/weatherRequest.php | 28 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index ea988d8..f5e9c0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ htaccess -scripts/config.js -img/FunctionProject_brand-logo.psd -img/FunctionProject.psd \ No newline at end of file +php/apiKey.php \ No newline at end of file diff --git a/incl/footer.php b/incl/footer.php index 0593598..16806bc 100644 --- a/incl/footer.php +++ b/incl/footer.php @@ -1,5 +1,5 @@ diff --git a/scripts/main.js b/scripts/main.js index 9f61043..397bf51 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -7,25 +7,10 @@ $(function () { $.getScript("/scripts/fonctions.js", function() { /* ÉXECUTION DES FONCTONS */ - $( "#submitWeatherRequest" ).click(function() - { - let city = $('#cityName').val(); - let cityName = city.split(' ').join('+'); - if(isEmptyValue(cityName)) - { - $('.results').html(emptyMessageError); - $("#cityName, #submitWeatherRequest").click(function() { - document.location.replace("../function-views/weatherRequest.php"); - }); - } - else - { - let url = "https://api.openweathermap.org/data/2.5/weather?q=" + cityName + "&lang=fr&units=metric&appid=" + config.APIkey + ""; - weatherRequest(url, 'weather'); - } - }); - $( "#submitRandomNumber" ).click(function() + // $("#submitWeatherRequest") se fait exécuter dans weatherRequest.php + + $("#submitRandomNumber").click(function() { let minEntered = $('#minValue').val(); let maxEntered = $('#maxValue').val(); @@ -48,7 +33,7 @@ $(function () { } }); - $( "#submitCalculateAge" ).click(function() + $("#submitCalculateAge").click(function() { let birthDateEntered = $('#birthDateValue').val(); @@ -70,7 +55,7 @@ $(function () { } }); - $( "#submitConvertTemperature" ).click(function() + $("#submitConvertTemperature").click(function() { let temperatureValue = $('#temperatureValue').val(); let degree = parseFloat(temperatureValue.slice(0, temperatureValue.length - 2)); @@ -94,7 +79,7 @@ $(function () { } }); - $( "#submitConvertDistance" ).click(function() + $("#submitConvertDistance").click(function() { let firstValueEntered = $('#firstValue').val(); let secondValueEntered = $("#secondValue option:selected").text(); @@ -124,7 +109,7 @@ $(function () { window.onload = realDateTime('realDateTime'); /* Window Scroll Top Button */ - var $btnScrollTop = $('.scroll-top'); + var $btnScrollTop = $('.scroll-top-arrow'); $(window).scroll(function () { if ($(this).scrollTop() > 100) { $btnScrollTop.fadeIn(); diff --git a/views/function-views/weatherRequest.php b/views/function-views/weatherRequest.php index ae41526..45e65e1 100644 --- a/views/function-views/weatherRequest.php +++ b/views/function-views/weatherRequest.php @@ -22,5 +22,33 @@ + + + + \ No newline at end of file