Skip to content

Instantly share code, notes, and snippets.

@doochik
Created April 26, 2018 19:19
Show Gist options
  • Save doochik/916d205ad7e279ab10e5c630bd07df14 to your computer and use it in GitHub Desktop.
Save doochik/916d205ad7e279ab10e5c630bd07df14 to your computer and use it in GitHub Desktop.
function on() {
document.getElementById("overlay").style.display = "block";
}
function off() {
document.getElementById("overlay").style.display = "none";
}
jQuery(document).ready(function($) {
var arr = ["t20","t40", "t50", "t60", "t65","t70","t75", "t80", "t85", "t90", "t95","t100","t105", "t110", "t115", "t120"];
$('body').on('click', '.submit', function() {
on();
var data = {};
data["pipe"] = $("#selectbasic").val();
data["press"] = $("#press").val();
for (var i = 0, j = arr.length; i < j; i++) {
var value = arr[i];
data[value] = $("input[name|='" + value + "']").val();
}
$.post("../6.php", data, function(response) {
var my_arr = JSON.parse(response)
if(response !== null ){
for (var i = 0, j = arr.length; i < j; i++) {
var value = arr[i];
var ai = $("input[name|='" + value + "']").parent().next();
ai.html((my_arr[value + "ai"]).toFixed(2));
ai.next().html(my_arr[value + "c"]);
}
$("#asum").html((my_arr['asum']).toFixed(2));
$("#atsum").html(my_arr['atsum']);
$("#lf").html(my_arr['lf']);
$("#limf").html(my_arr['limf']);
$("#tsl").html(my_arr['tsl']);
off();
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment