Code for from Form Serialization Submission in JS

  • 2021-07-13 03:51:22
  • OfStack

No more nonsense, just post the code for everyone. The specific code is as follows:


// ----ajax begin
  $.ajax({
type: "POST",
   url: "../compRule/updateRuleById?tids="+compTableName_val+"&isReportName="+$('#isReport_update').val()+"&heji_add="+$('#heji_update').val(),
   async:false,
   data:$("#update_form1").serialize(),
   dataType: "text",
   success: function(data){
   $("#search").click();
   $.success(" Operation successful ");
   setTimeout(function(){
layer.closeAll();
},1000);  
   },
  error : function(data){
  $.fail(' Operation failed! ');
  }
 });
 //----ajax end

Submit to the background with ajax. If the corresponding value is not received with serialization, or the value is Null, spell the value on url


Related articles: