GMB Health Check

<script src=’https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js’><script type="text/javascript">
function ajaxstart() {
if(jQuery(‘body’).find(‘#resultLoading’).attr(‘id’) !=’resultLoading’) {
jQuery(‘body’).append(“

“);
}

jQuery(‘#resultLoading’).css({
‘width’:’100%’,
‘height’:’100%’,
‘position’:’fixed’,
‘z-index’:’10000000′,
‘top’:’0′,
‘left’:’0′,
‘right’:’0′,
‘bottom’:’0′,
‘margin’:’auto’
});

jQuery(‘#resultLoading .bg’).css({
‘background’:’#000000′,
‘opacity’:’0.7′,
‘width’:’100%’,
‘height’:’100%’,
‘position’:’absolute’,
‘top’:’0′
});

jQuery(‘#resultLoading>div:first’).css({
// ‘width’: ‘250px’,
‘height’:’75px’,
‘text-align’: ‘center’,
‘position’: ‘fixed’,
‘top’:’-50px’,
‘left’:’0′,
‘right’:’0′,
‘bottom’:’0′,
‘margin’:’auto’,
‘font-size’:’16px’,
‘z-index’:’10’,
‘color’:’#ffffff’

});

jQuery(‘#resultLoading .bg’).height(‘100%’);
jQuery(‘#resultLoading’).fadeIn(300);
}

function ajaxstop() {
jQuery(‘#resultLoading .bg’).height(‘100%’);
jQuery(‘#resultLoading’).fadeOut(300);
jQuery(‘body’).css(‘cursor’, ‘default’);
}

$(‘#showsuccess’).hide();
$(‘#showdanger’).hide();

/* Please add these script at the end of code for form validation */
$(“#check_btn").on(‘click’, function(e) {
e.preventDefault();
var full_name=$(“#gmbres_fullname").val();
var email=$(“#gmbres_email").val();
var mapurl=$(“#gmbres_mapurl").val();
var phone=$(“#gmbres_phone").val();

function ValidateEmail(email)
{
var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return expr.test(email);
};

function isurl(key){
var regex=new RegExp(“^(https:\/\/www\.\google\.[a-z]{1,5}\/maps\/place\/.*\/.*\/data=).*$");

//var key = String.fromCharCode(event.charCode ? event.which : event.charCode);
if ( !regex.test(key)) {
return false;
}

else {
return true;
}
}

if(full_name==") {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter full name’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else if(email==") {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter valid Email address’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else if(ValidateEmail(email)==false) {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter Valid Email’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else if(mapurl==") {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter map url’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else if(isurl(mapurl)==false) {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter correct map url’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else if(phone==") {
$(‘#textdanger’).html(");
$(‘#textdanger’).html(‘Enter valid Phone No’);
$(‘#textdanger’).css(‘color’, ‘red’);
return false;
}

else {

ajaxstart() var senddata= {
‘fullname’:full_name, ‘mapurl’:mapurl, ‘phone’:phone, ‘Email’:email, ‘iframekey’:’WOCG-3332-ELWX-AOTKQ’
}

$.ajax({

type:’post’,
data:senddata,
url:’https://www.citationbuilderpro.com/app/add-health-lead’,
crossDomain: true,
success:function(data) {
var jsondata=$.parseJSON(data) ajaxstop() if(jsondata.errorCode==200) {
if(jsondata.getAction==’1′) {
window.open(jsondata.redurl, “_self");
$(‘.formhide’).hide();
$(‘#showsuccess’).css(‘display’, ‘block’);
$(‘#showsuccess’).html(‘

Thank you

‘);

setTimeout(function () {
location.reload();
}

, 2000);

}

else if(jsondata.getAction==’2′) {

$(‘.formhide’).hide();
$(‘#showsuccess’).css(‘display’, ‘block’);
$(‘#showsuccess’).html(‘

Thank you for the filled form we will contact as soon as possible

‘);

setTimeout(function () {
location.reload();
}

, 2000);
}

else if(jsondata.getAction==’3′) {
window.open(jsondata.redurl, “_self");
}

else {

$(‘.formhide’).hide();
$(‘#showdanger’).css(‘display’, ‘block’);
$(‘#showdanger’).html(‘

Contact to support

‘);

setTimeout(function () {
location.reload();
}

, 2000);
}

}

else if(jsondata.errorCode==404) {
$(‘.formhide’).hide();
$(‘#showdanger’).css(‘display’, ‘block’);
$(‘#showdanger’).html(‘

‘ +jsondata.errorMsg+’

‘);

setTimeout(function () {
location.reload();
}

, 3000);
}

else {

$(‘.formhide’).hide();
$(‘#showdanger’).css(‘display’, ‘block’);
$(‘#showdanger’).html(‘

‘ +jsondata.errorMsg+’

‘);

setTimeout(function () {
location.reload();
}

, 3000);
}
}
})
}

});