JSFiddle - React, Tailwind, and code Playground

by gRoberts

HTML

<input type="text" id="params" value="LON-NYC-Sep:Jun-M-true" /><input type="button" id="go" value="Go" />

JavaScript

var price, tmpPrice, params, departure, destination, objSolr, ow, qStr, parts, responseStr, months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'], mI;

/**
 * Parameter values:
 *
 * LON-NYC-Sep:Jun-M-true
 * LON-NYC-Sep-M-true
 * LON-NYC-Sep:Jun-W-true
 * LON-NYC-Jun-W-false
 *
 * LON - Departure city
 * NYC - Destination city
 * Jun - Month
 * Sep:Jun - Month range
 * M - Cabin type
 * true/false - One way/return
 *
 */

function queryLPBM(query) {
    "use strict";
    params = query.split('-');
    departure = params[0];
    destination = params[1];
    responseStr = '{"responseHeader":{"status":0,"QTime":1,"params":{"q":"departure_city:LON ","wt":"json","fq":"arrival_city:LAX "}},"response":{"numFound":1,"start":0,"docs":[{"dep_city_country_cd":"GB","jul_far":81,"may_far":72,"sun_jul":12.0,"dec_far":66,"sep_cel":27,"sun_jan":7.0,"aug_far":82,"country_details_string":"United Kingdom,GB","journey_time":660,"feb_cel":19,"rownumber":"14","jan_cel":18,"rain_oct":15.0,"sun_jun":10.0,"sun_aug":11.0,"rain_apr":25.0,"sun_nov":8.0,"mar_cel":19,"apr_far":70,"aug_cel":28,"route_connection_ind":"N","is_ba_operated":"Y","sun_feb":8.0,"rain_feb":76.0,"sun_sep":10.0,"nov_cel":23,"arrival_city":"LAX","rain_nov":31.0,"sun_dec":8.0,"rain_dec":66.0,"mar_far":66,"oct_cel":24,"BCH":"true","dep_city_long_degrees":-0.1262362,"city_details_string":"000097,London,LON,GB","city_sort_order":97,"rain_sep":5.0,"may_cel":22,"sun_oct":9.0,"rain_aug":0.0,"rain_jan":79.0,"oct_far":75,"jun_far":75,"nov_far":73,"dep_city_country_nm":"United Kingdom","arr_city_long_degrees":-118.24368,"LUX":"true","departure_city":"LON","rain_jun":3.0,"sun_apr":9.0,"jun_cel":24,"rain_jul":0.0,"dec_cel":19,"dep_city_lat_degrees":51.500153,"arr_city_name":"Los Angeles","arr_city_lat_degrees":34.052235,"dep_city_name":"London","sun_mar":9.0,"dest_search_cities":"Los Angeles, USA, LAX/34.0522342,-118.2436849","feb_far":66,"jan_far":64,"arr_city_text":"You\'ll be lured to Los...