$(document).ready(function () { $("#as_btn").click(function () { as_email = $("#as_email").val(); as_cid = $("#as_cid").val(); if(isEmail(as_email) == false){ $("#as_email").addClass('err'); }else{ $.ajax({ url: '{{$hostName}}'+'/campaign/email_status', data: { '_token': '{{ csrf_token() }}', 'as_email': as_email, 'as_cid': as_cid }, dataType: 'json', type: 'post', success: function (response) { if(response !=0){ $("#pop_err").hide(); url = response.pURL; window.location = url; /* $('#ref_link').attr('href',response.rURL); $('#track_link').attr('href',response.pURL); $('#leader_link').attr('href',response.lURL); $('.optin_wrap').hide(); $('.already_text').hide(); $('.signed_overlay').hide(); $('#hs_blk').show(); */ }else{ //alert('email invalid'); $("#pop_err").show(); } /* //alert(response.type); if (response.type = 'success') { window.location.reload(); } else { } */ }, }); } }); });