1/* --------------------------------------------- 2 Contact form 3 --------------------------------------------- */ 4 5jQuery.noConflict(); 6var $ = jQuery; 7 8$(document).ready(function(){ 9 $("#submit_btn").click(function(){ 10 11 //get input field values 12 var user_name = $('input[name=name]').val(); 13 var user_email = $('input[name=email]').val(); 14 var user_message = $('textarea[name=message]').val(); 15 16 //simple validation at client's end 17 //we simply change border color to red if empty field using .css() 18 var proceed = true; 19 if (user_name == "") { 20 $('input[name=name]').css('border-color', '#e41919'); 21 proceed = false; 22 } 23 if (user_email == "") { 24 $('input[name=email]').css('border-color', '#e41919'); 25 proceed = false; 26 } 27 28 if (user_message == "") { 29 $('textarea[name=message]').css('border-color', '#e41919'); 30 proceed = false; 31 } 32 33 //everything looks good! proceed... 34 if (proceed) { 35 //data to be sent to server 36 post_data = { 37 'userName': user_name, 38 'userEmail': user_email, 39 'userMessage': user_message 40 }; 41 42 //Ajax post data to server 43 $.post('contact_me.php', post_data, function(response){ 44 45 //load json data from server and output message 46 if (response.type == 'error') { 47 output = '<div class="error">' + response.text + '</div>'; 48 } 49 else { 50 51 output = '<div class="success">' + response.text + '</div>'; 52 53 //reset values in all input fields 54 $('#contact_form input').val(''); 55 $('#contact_form textarea').val(''); 56 } 57 58 $("#result").hide().html(output).slideDown(); 59 }, 'json'); 60 61 } 62 63 return false; 64 }); 65 66 //reset previously set border colors and hide all message on .keyup() 67 $("#contact_form input, #contact_form textarea").keyup(function(){ 68 $("#contact_form input, #contact_form textarea").css('border-color', ''); 69 $("#result").slideUp(); 70 }); 71 72});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.