jQuery(document).ready(function () { if (jQuery(".tunggu img").length == 0) return false; var img_link = jQuery(".tunggu img").attr("src").replace("load.gif", "tutup.png"); jQuery("body").append('
Input yang berwarna merah mohon diisi.
'); jQuery("bg, .peringatan img").click(function () { jQuery('bg, .peringatan').removeClass("njedul").addClass("ireng"); setTimeout(function () { jQuery('bg, .peringatan').removeClass("ireng"); }, 350); }); jQuery("table input, table textarea").blur(function () { var ini = jQuery(this); var eml = ' @yahoo, @gmail, @outlook, @hotmail'; var emDown = ini.val().split('@'); if (emDown.length > 1) { emDown = emDown[1].split("."); } if (ini.attr("id") !== "eks" && ini.val() == "") { ini.parent().find("warning").remove(); ini.focus(); ini.after("Harus Diisi"); setTimeout(function () { jQuery("warning").addClass("njedul"); }, 0); } else if (ini.attr("id") == "emDown" && eml.indexOf('@' + emDown[0]) > 0) { ini.parent().find("warning").remove(); ini.focus(); ini.after("Cantumkan email perusahaan
Contoh: NamaAnda@perusahaanAnda
Free Email (" + eml.replace(/[@]|outlook,/g, '') + ") is not Allowed
"); setTimeout(function () { jQuery("warning").addClass("njedul"); }, 0); } else { ini.removeClass("abang"); jQuery("warning").removeClass("njedul"); setTimeout(function () { jQuery("warning").remove(); }, 500); } }); jQuery(".formZainInput").click(function () { jQuery(this).removeClass("abang"); }); }); //============== Untuk Mengirim Pesan/Register/Request/IHT ========// function kirim(a) { let box_form = a.closest('.zainformpost'), loading_send = box_form.querySelector(".tunggu img"), pesan = box_form.querySelector(".proses"); loading_send.style.display = "inline-block"; let data_form = { form: box_form.querySelector("h5").innerText }; box_form.querySelectorAll('.formZainInput').forEach(el => { if (el.name !== "eks" && el.value == "") el.classList.add("abang"); data_form[el.name] = [el.closest("tr").querySelector("td").innerText.replace(/\*/g, ""), el.value]; }); fetch('https://form.freshgroup.my.id', { method: 'POST', // HTTP method headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data_form) // Convert JavaScript object to JSON }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } return response.json(); // Convert response to JSON }) .then(data => { console.log(data); loading_send.style.display = "none"; pesan.innerHTML = data.pesan; pesan.style.backgroundColor = "#99ccff"; setTimeout(() => { pesan.style.backgroundColor = "transparent"; }, 3000); }) // Handle successful response .catch(error => console.error('Error:', error)); } function kirims_old(a) { if (a.name == "tes") { send_form(a); return false; } Captcha = true; var CPC = Qsa("[name='captcha']"); if (CPC.length) { var CPC = CPC[0]; Captcha = false; var Ck = document.cookie.split("; "); var cok = {} for (var i in Ck) { var c = Ck[i].split("="); cok[c[0]] = c[1] } if (cok["itswCapt"] == CPC.value) Captcha = true; //alert(Qsa("[name='captcha']").length); } if (Captcha) { //alert(document.cookie); var id = jQuery(a).parent().parent().parent().parent().parent().attr('id'); var inputFormDiv = document.getElementById(id); var cls = inputFormDiv.getElementsByClassName('formZainInput'); var l = cls.length; var jml = l; var ex = ""; for (var z = 0; z < l; z++) { var idz = cls[z].id; var vlz = cls[z].value; if (idz !== "eks" && vlz == "") { ex += cls[z].id + ', '; cls[z].className += " abang"; } else { jml = parseInt(jml) - 1; } } if (jml > 0) { jQuery('bg, .peringatan').addClass("ireng"); setTimeout(function () { jQuery('bg, .peringatan').removeClass("ireng").addClass("njedul"); }, 350); } else { jQuery("#" + id + " .tunggu img").css("display", "inline-block"); var patch = ""; if (pinka_link !== 0) { for (i = 0; i < pinka_link; i++) { patch += "../"; } } var inpt = jQuery("#" + id + " .formZainLi").length; var ids = "?Form=" + encodeURI(jQuery("#" + id + " H5").text()); jQuery("#" + id + ' .formZainLi').each(function (xz) { if (jQuery(this).find('[name="captcha"]').length == 0) { var dan = '&'; //if(xz==0){ var dan="";} var str = jQuery(this).find('td:first-child').text().replace(/ :/g, "").replace(/ /g, "_"); ids += dan + str + "=" + encodeURI(jQuery(this).find('.formZainInput').val()); } jQuery(this).find('.formZainInput').val(""); }); //jQuery("#"+id+" .proses").load(patch+"wp-content/plugins/form-zain/form-zain-proses.php"); var ids = ids.replace(/\*/g, ""); //alert(patch+"wp-content/plugins/form-zain/form-zain-proses.php"+ids); jQuery("#" + id + " .proses").load(patch + "wp-content/plugins/form-zain/proses.php" + ids); }/**/ } else alert("No Captcha tidak sesuai !!!"); } //====== Untuk Keterangan Input========// function bg_klik(a, b) { if (b == "a") { jQuery(a).css("display", "none"); jQuery(a).next().focus(); } else if (b == "b") { if (jQuery(a).val() == "") { jQuery(a).prev().css("display", "none"); } } else if (b == "c") { if (jQuery(a).val() == "") { jQuery(a).prev().css("display", "inline-block"); } } }