Hotfix: weatherRequest getCityName -POST serialize
This commit is contained in:
@ -8,15 +8,16 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
$("#submitWeatherRequest").click(() => {
|
||||
$("#submitWeatherRequest").click((event) => {
|
||||
event.preventDefault();
|
||||
const city = $('#cityName').val();
|
||||
const cityName = city.split(' ').join('+');
|
||||
const cityName = city.split(' ').join('+');
|
||||
const data = `city=${cityName}`;
|
||||
if(isEmptyValue(cityName)) {
|
||||
$('.results').html(emptyMessageError);
|
||||
}
|
||||
else {
|
||||
createSessionCookie("city", cityName);
|
||||
weatherRequest();
|
||||
weatherRequest(data);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -12,10 +12,11 @@
|
||||
* @example
|
||||
* Ajoute au DOM de la page dans la div .results, la météo de la ville demandée.
|
||||
*/
|
||||
function weatherRequest() {
|
||||
function weatherRequest(cityData) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/php/getWeatherJson.php',
|
||||
type: "POST",
|
||||
data: cityData,
|
||||
success: function(data) {
|
||||
try {
|
||||
const json = jQuery.parseJSON(data);
|
||||
|
Reference in New Issue
Block a user