if (typeof jQuery == 'undefined'){ var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://code.jquery.com/jquery-3.2.1.min.js"; script.onload = function() { var jQuery = window.jQuery; cIframe(); }; document.getElementsByTagName("head")[0].appendChild(script); }else{ cIframe(); } function cIframe(){ if(typeof npf_s != "undefined"){ $zopim(function(a) { $zopim.livechat.clearAll(); $zopim.livechat.setOnChatStart(function() { var email = $zopim.livechat.getEmail(); var phone = $zopim.livechat.getPhone(); var name = $zopim.livechat.getName(); preRegistrations(email,phone,name) }); }); } } function preRegistrations(email,phone,name){ jQuery.ajax({ url: "https://api.nopaperforms.com/dataPorting/"+npf_c+"/chat", type: "post", data: { Email: email, mobile: phone, name : name, type : "zopim", secret_key:npf_s }, dataType: "jsonp", success: function (json) { }, error:function(){ } }); }