[php] app
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <?php
- $var = 'function getBathValue() {
- var uiBathrooms = document.getElementByName("uiBathrooms");
- for (var i in uiBathrooms) {
- if(uiBathrooms[i].checked) {
- return parseInt(i)+1;
- }
- }
- return -1; // Invalid Value
- }
- function getBHKValue() {
- var uiBHK = document.getElementsByName("uiBHK");
- for(var i in uiBHK) {
- if(uiBHK[i].checked) {
- return parseInt(i)+1;
- }
- }
- return -1; // Invalid Value
- }
- 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"; //Use this if you are NOT using nginx which is first 7 tutorials
- //var url = "/api/predict_home_price"; // Use this if you are using nginx. i.e tutorial 8 and onwards
- $.post(url, {
- total_sqft: parseFloat(sqft.value),
- bhk: bhk,
- bath: bathrooms,
- location: location.value
- },function(data, status) {
- console.log(data.estimated_price);
- estPrice.innerHTML = "<h2>" + data.estimated_price.toString() + " Lakh</h2>";
- console.log(status);
- });
- }
- function onPageLoad() {
- console.log( "document loaded" );
- var url = "http://127.0.0.1:5000/get_location_names"; // Use this if you are NOT using nginx which is first 7 tutorials
- //var url = "/api/get_location_names"; // Use this if you are using nginx. i.e tutorial 8 and onwards
- $.get(url,function(data, status) {
- console.log("got response for get_location_names request");
- if(data) {
- var locations = data.locations;
- var uiLocations = document.getElementById("uiLocations");
- $(\'#uiLocations\').empty();
- for(var i in locations) {
- var opt = new Option(locations[i]);
- $(\'#uiLocations\').append(opt);
- }
- }
- });
- }
- window.onload = onPageLoad;';
Editor
You can edit this paste and save as new:
File Description
- app
- Paste Code
- 24 Mar-2023
- 2.18 Kb
You can Share it: