JSFiddle - React, Tailwind, and code Playground
by Chris Hughes
JavaScript
$(function () {
$(document).ready(function () {
$(function () {
$('#station_selector').selectmenu({ //Acts when the user selects a station
select: function () {
//Declaring initial variables
var chart;
var daysInMonth = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
var ranges;
var CityCode = "NULL";
//Set city code based on user selection
if (station_selector[1].selected === true) {
CityCode = "NUF";
} else if (station_selector[2].selected === true) {
CityCode = "WNC";
} else if (station_selector[3].selected === true) {
CityCode = "WPR";
} else if (station_selector[4].selected === true) {
CityCode = "DOV";
} else if (station_selector[5].selected === true) {
CityCode = "GRE";
} else if (station_selector[6].selected === true) {
CityCode = "MIL";
} else if (station_selector[7].selected === true) {
CityCode = "GE1";
} else if (station_selector[8].selected === true) {
CityCode = "GE2";
} else if (station_selector[9].selected === true) {
CityCode = "LEW";
}
$.ajaxSetup({
async: false
});
// Sets AJAX call to get Monthly data from files
var test_variable = "Tmax";
$.getJSON('CLIMATE_NORMS/ajax.php?station_code=' + CityCode + '&test_variable=' + test_variable + '&test_type=Monthly', function (data) {
...