jQuery(document).ready(function(){ jQuery("button.btnSend").click(function(){ var form = jQuery(this).closest('form'); jQuery.ajax({type:'POST', url: 'http://www.coastalhelicopters.com/helitour/wp-content/themes/florida-wp/inc/contactus/contact2.php', data:jQuery(form).serialize(), success: function(response) { if(parseInt(response)>0) { if(jQuery(form).find("#spanMessage").length) jQuery(form).find("#spanMessage").html('
Well done! Your message has been sent.
'); else alert('Well done! Your message has been sent'); } else{ if(jQuery(form).find("#spanMessage").length) jQuery(form).find("#spanMessage").html('
Error! Somthing Wrong
'); else alert('Somthing wrong!'); } }}); }); });