$0.008334 / hour = $6.00 / 30 days
console.log("document_ready"); $("#diy_form").on('change', function() { console.log("form changed!"); // setup some local variables var $form = $(this); // let's select and cache all the fields var $inputs = $form.find("select"); // serialize the data in the form var serializedData = $form.serialize();
// let's disable the inputs for the duration of the ajax request $inputs.prop("disabled", true);
console.log(serializedData); // fire off the request to /form.php request = $.ajax({ url: "https://dev-ops.mnx.io/vms/calculate_price/", type: "post", dataType: 'jsonp', data: serializedData, });
console.log("After the POST"); // callback handler that will be called on success request.done(function (response){ console.log("Done!"); $('#diy_hourly').text(response.hourly_price); $('#diy_monthly').text(response.monthly_price); });
// callback handler that will be called on failure request.fail(function (jqXHR, textStatus, errorThrown){ console.log("Error"); });
// callback handler that will be called regardless // if the request failed or succeeded request.always(function () { // reenable the inputs $inputs.prop("disabled", false); });
// prevent default posting of form event.preventDefault(); });
Recent Comments