function getBathValue() { var uiBathrooms = document.getElementsByName("uiBathrooms"); for(var i in uiBathrooms) { if(uiBathrooms[i].checked) { return parseInt(i)+1; } } return -1; } function getBHKValue() { var uiBHK = document.getElementsByName("uiBHK"); for(var i in uiBHK) { if(uiBHK[i].checked) { return parseInt(i)+1; } } return -1; } function onClickedEstimatePrice() { console.log("Estimate price button clicked"); var sqft = document.getElementById("uiSqft"); var bhk = getBHKValue(); var bathrooms = getBathValue(); var location = document.getElementById("uiLocations"); var estPrice = document.getElementById("uiEstimatedPrice"); // var url = "http://127.0.0.1:5000/predict_home_price"; var url = "api/predict_home_price"; $.post(url, { total_sqft: parseFloat(sqft.value), bhk: bhk, bath: bathrooms, location: location.value },function(data, status) { console.log(data.estimated_price); estPrice.innerHTML = "