JSFiddle - React, Tailwind, and code Playground

by Gothor

HTML

<select id="monSelect">
    <option>2011</option>
    <option>2012</option>
</select>

JavaScript

var selected_year;
var postsales;

$(function() {
    selected_year = $("#monSelect").val();
    postsales = "type_data=Job&type_areaOUcountry=Learner_Country&nom_data=postsales&year=" + selected_year + "&month=all&areaOUcountry=";
    alert(postsales);
    
    //Récupération au changement de valeur du select.
    $("#monSelect").on('change',function(){
        selected_year = $("#monSelect").val();
        postsales = "type_data=Job&type_areaOUcountry=Learner_Country&nom_data=postsales&year=" + selected_year + "&month=all&areaOUcountry=";
        alert(postsales);
    });
});