Spaces:
No application file
No application file
Commit
•
649283b
1
Parent(s):
d469bcb
Delete script.js
Browse files
script.js
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
function getBathValue() {
|
2 |
-
var uiBathrooms = document.getElementsByName("uiBathrooms");
|
3 |
-
for(var i in uiBathrooms) {
|
4 |
-
if(uiBathrooms[i].checked) {
|
5 |
-
return parseInt(i)+1;
|
6 |
-
}
|
7 |
-
}
|
8 |
-
return -1;
|
9 |
-
}
|
10 |
-
|
11 |
-
function getBHKValue() {
|
12 |
-
var uiBHK = document.getElementsByName("uiBHK");
|
13 |
-
for(var i in uiBHK) {
|
14 |
-
if(uiBHK[i].checked) {
|
15 |
-
return parseInt(i)+1;
|
16 |
-
}
|
17 |
-
}
|
18 |
-
return -1;
|
19 |
-
}
|
20 |
-
|
21 |
-
function onClickedEstimatePrice() {
|
22 |
-
console.log("Estimate price button clicked");
|
23 |
-
var sqft = document.getElementById("uiSqft");
|
24 |
-
var bhk = getBHKValue();
|
25 |
-
var bathrooms = getBathValue();
|
26 |
-
var location = document.getElementById("uiLocations");
|
27 |
-
var estPrice = document.getElementById("uiEstimatedPrice");
|
28 |
-
|
29 |
-
// var url = "http://127.0.0.1:5000/predict_home_price";
|
30 |
-
var url = "api/predict_home_price";
|
31 |
-
|
32 |
-
$.post(url, {
|
33 |
-
total_sqft: parseFloat(sqft.value),
|
34 |
-
bhk: bhk,
|
35 |
-
bath: bathrooms,
|
36 |
-
location: location.value
|
37 |
-
},function(data, status) {
|
38 |
-
console.log(data.estimated_price);
|
39 |
-
estPrice.innerHTML = "<h2>" + data.estimated_price.toString() + " Lakh</h2>";
|
40 |
-
console.log(status);
|
41 |
-
});
|
42 |
-
}
|
43 |
-
|
44 |
-
function onPageLoad() {
|
45 |
-
console.log( "document loaded" );
|
46 |
-
// var url = "http://127.0.0.1:5000/get_location_names";
|
47 |
-
var url = "api/get_location_names";
|
48 |
-
$.get(url,function(data, status) {
|
49 |
-
console.log("got response for get_location_names request");
|
50 |
-
if(data) {
|
51 |
-
var locations = data.locations;
|
52 |
-
var uiLocations = document.getElementById("uiLocations");
|
53 |
-
$('#uiLocations').empty();
|
54 |
-
for(var i in locations) {
|
55 |
-
var opt = new Option(locations[i]);
|
56 |
-
$('#uiLocations').append(opt);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
});
|
60 |
-
}
|
61 |
-
|
62 |
-
window.onload = onPageLoad;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|