Jquery How to send HTTP request after form control ?
Hello
How to send a HTTP request with Ajax after checking if the inputs ".name_column" and ".taille" are not empty.
Both inputs are create dinamycally with the append function.
Than you in adavance.
Joce.
- $(".btn_validate").click(function () {
- //alert('btn_validate');
-
- //---------------------------
- //FORM CONTROL
- //---------------------------
-
- $('.name_column').each(function(){
-
- $(this).change(function(){
- $(this).css({"border" : "", "background-color" : ""});
- });
-
- if( !$(this).val() ){
- $(this).css({"border" : "1px solid red", "background-color" : "#FFEEF0"});
- $( "#alertBox" ).fadeIn(500).delay(1200).fadeOut(500).html("<p style='display:inline-block; width:20%; height:100px; line-height:100px; vertical-align:middle;'><span style='font-size:3em;' class='heydings_controls'>G</span></p><p style='display:inline-block; width:70%; height:25px; line-height:25px; vertical-align:middle; text-align:left;'> Veuillez saisir le nom.</p>");
- $("html, body").animate({ scrollTop: 0 }, "slow");
- return false;
- }
-
-
-
- });
-
- $('.taille').each(function(){
- $(this).change(function(){
- $(this).css({"border" : "", "background-color" : ""});
- });
-
- if( !$(this).val() ){
- $(this).css({"border" : "1px solid red", "background-color" : "#FFEEF0"});
- $( "#alertBox" ).fadeIn(500).delay(1200).fadeOut(500).html("<p style='display:inline-block; width:20%; height:100px; line-height:100px; vertical-align:middle;'><span style='font-size:3em;' class='heydings_controls'>G</span></p><p style='display:inline-block; width:70%; height:25px; line-height:25px; vertical-align:middle; text-align:left;'> Veuillez saisir la taille.</p>");
- $("html, body").animate({ scrollTop: 0 }, "slow");
- return false;
- }
-
- });
- //---------------------------
- //SERVER CONNEXION
- //---------------------------
- var formData = $( "#mySQL_table" ).serialize();
- alert(formData);
-
- $.ajax({
- type: "POST",
- url: "process.php",
- data: formData,
- dataType: "html",
- success: function(data){
- //$('#mySQL_table')[0].reset();
- //alert(data);
- $( "#showFormProcess" ).html(data);
- }
- });
-
-
- });