$(document).ready(function () {
// page will load with initial values
loan_amount_tooltip(); // shows the current loan amount as the user types
zc_lookup(); // if all values are typed in, the ajax request is sent to retrieve interest rates
paymentCalculation();
maskInputValues();
$('#progressbar').css({
background: '#ccc'
});
$("#id_property_value, #id_loan_type, #id_loan_balance, #id_down_payment, #id_cash_out, #id_zip_code, #id_credit_score, #id_property_type, select, #circles-slider").on("keyup change slidestop", function (event) {
loan_amount_tooltip();
zc_lookup(); // if all values are typed in, the ajax request is sent to retrieve interest rates
});
$("#id_loan_amount_calculator, #id_interest_rate, #id_months").on("keyup change", function (event) {
paymentCalculation(); // monthly payment calculator
});
}); // end of document (function)
function zc_lookup() {
var zip_flag = 0;
var zip_message = document.getElementById("zcode");
if ($('#id_zip_code').val().length >= 1) {
$.ajax({
type: "GET",
url: "/zip_test/",
data: {
'zc_check': $('#id_zip_code').val()
},
success: function (data) {
// data is in the following format: a dictionary inside an array inside an array
// [1, [{"county": "Montgomery"}], [{"state": "maryland"}]]
if (data[0] == 1) {
user_county = data[1][0].county;
user_state = data[2][0].state;
zip_message.style.display = 'none';
field_checks(); // since AJAX is asyncronous, we want to wait for the value to be retured before proceeding; otherwise, the function will continue executing without the returned value
} else {
zip_message.style.display = 'block';
searchSuccess(0); // call...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.