var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opens = _____WB$wombat$assign$function_____("opens"); $(document).ready(function($) { $("#submit_btn").click(function() { var proceed = true; //simple validation at client's end //loop through each field and we simply change border color to red for invalid fields $("#contact_form input[required=true], #contact_form textarea[required=true]").each(function(){ $(this).css('border-color',''); if(!$.trim($(this).val())){ //if this field is empty $(this).css('border-color','red'); //change border color to red proceed = false; //set do not proceed flag } //check invalid email var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if($(this).attr("type")=="email" && !email_reg.test($.trim($(this).val()))){ $(this).css('border-color','red'); //change border color to red proceed = false; //set do not proceed flag } }); if(proceed) //everything looks good! proceed... { //get input field values data to be sent to server post_data = { 'user_name' : $('input[name=name]').val(), 'user_email' : $('input[name=email]').val(), 'msg' : $('textarea[name=message]').val() }; //can we find that page? //var testurl = '/wp-content/themes/openbikeinitiative/contact_me.php'; var testurl = ContactMe.templateUri + '/contact_me.php'; /* $.ajax( { type: "get", url: testurl, cache: false, statusCode: { 404: function () { alert('url: ' + testurl + '\r\n[page not found]'); } }, async: true }); */ //Ajax post data to server $.post(testurl, post_data, function(response){ if(response.type == 'error'){ //load json data from server and output message output = '
'+response.text+'
'; }else{ output = '
'+response.text+'
'; //reset values in all input fields $("#contact_form input[required=true], #contact_form textarea[required=true]").val(''); $("#contact_form #contact_body").slideUp(); //hide form after success } $("#contact_form #contact_results").hide().html(output).slideDown(); }, 'json'); //alert('complete'); } }); //reset previously set border colors and hide all message on .keyup() $("#contact_form input[required=true], #contact_form textarea[required=true]").keyup(function() { $(this).css('border-color',''); $("#result").slideUp(); }); }); } /* FILE ARCHIVED ON 20:35:25 Feb 22, 2017 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 19:42:37 Nov 16, 2025. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): captures_list: 0.736 exclusion.robots: 0.025 exclusion.robots.policy: 0.011 esindex: 0.013 cdx.remote: 10.748 LoadShardBlock: 157.016 (3) PetaboxLoader3.datanode: 286.145 (5) PetaboxLoader3.resolve: 175.027 (3) load_resource: 363.289 (2) */