$(document).ready(function() { // submit form $("#newleadform").unbind('submit').bind('submit', function() { $(".text-danger").remove(); var form = $(this); // validation var assettitle = $("#assettitle").val(); var customquestion1 = $("#cq1").val(); var customquestion2 = $("#cq2").val(); var customquestion3 = $("#cq3").val(); var customquestion4 = $("#cq4").val(); var customquestion5 = $("#cq5").val(); var customquestion6 = $("#cq6").val(); var customquestion7 = $("#cq7").val(); var customquestion8 = $("#cq8").val(); var customquestion9 = $("#cq9").val(); var customquestion10 = $("#cq10").val(); var customquestion11 = $("#cq11").val(); var customquestion12 = $("#cq12").val(); var customquestion13 = $("#cq13").val(); var customquestion14 = $("#cq14").val(); var customquestion15 = $("#cq15").val(); if(assettitle) { //submit the form to server $.ajax({ url : '../pages/php_action/addnewlead/createlead.php', type : 'POST', data : form.serialize(), dataType : 'json', success:function(response) { // remove the error $(".form-group").removeClass('has-error').removeClass('has-success'); if(response.success == true) { $(".messages").html('
'+ ''+ ''+response.messages+ '
'); // reset the form $("#newleadform")[0].reset(); } else { $(".messages").html('
'+ ''+ ''+response.messages+ '
'); } // /else } // success }); // ajax subit } /// if return false; }); // /submit form for create member }); // /add modal