This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/scripts/execute-function/weatherRequest_DOM.js

17 lines
580 B
JavaScript

import { weatherRequest } from '../functions/fonctions_principales/weatherRequest_Function.js';
import { isEmptyValue } from '../functions/fonctions_annexes/isEmptyValue_Function.js';
$(function () {
$("#weatherForm").submit((event) => {
event.preventDefault();
const city = $('#cityName').val();
const cityName = city.split(' ').join('+');
const data = `city=${cityName}`;
if(isEmptyValue(cityName)) {
$('.results').html(emptyMessageError);
}
else {
weatherRequest(data);
}
});
});