weatherRequest execution in weatherRequest.php
This commit is contained in:
parent
76cef53523
commit
6f50a4c1a9
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,2 @@
|
||||
htaccess
|
||||
scripts/config.js
|
||||
img/FunctionProject_brand-logo.psd
|
||||
img/FunctionProject.psd
|
||||
php/apiKey.php
|
@ -1,5 +1,5 @@
|
||||
<footer class="text-center">
|
||||
<a href="#" class="scroll-top important"><i class="fas fa-arrow-up"></i></a>
|
||||
<a href="#" class="scroll-top-arrow important"><i class="fas fa-arrow-up"></i></a>
|
||||
<div class="realDateTime">Affichage de l'heure en temps réel : <span class="important" id="realDateTime"></span></div>
|
||||
<div class="footer-text"><a href="https://divlo.fr/" target="_blank">Divlo</a> | Tous droits réservés</div>
|
||||
</footer>
|
||||
|
@ -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();
|
||||
|
@ -22,5 +22,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Exécution de la fonction weatherRequest() -->
|
||||
<?php include("../../php/apiKey.php"); ?>
|
||||
<script>
|
||||
$(function () {
|
||||
// Fichiers qui contient les fonctions
|
||||
$.getScript("/scripts/fonctions.js", function() {
|
||||
|
||||
$( "#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=<?php echo $apiKey ?>";
|
||||
weatherRequest(url, 'weather');
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<!-- Footer -->
|
||||
<?php include("../../incl/footer.php");?>
|
Reference in New Issue
Block a user