javascript - Serialize form and combine with other value in ajax data -


this question has answer here:

i have ajax this.

 var idlapkondisi = $('#id_laporan_pemeriksa').val();   var data = $('#myformkondisi').serialize();   $.ajax({                 type:'ajax',                 method:'post',                 url:url,                 datatype:'json',                 success:function(response){                  },                 error:function(response){                  console.log(response);                 }               })   }) 

how can make 2 value in ajax data while value serialize data form ? format ?

 data:{data,idlapkondisi:idlapkondisi}, 

use serializearray instead of serialize.

  var idlapkondisi = $('#id_laporan_pemeriksa').val();   var data = $('#myformkondisi').serializearray();   data.push({name: "idlapkondisi", value: idlapkondisi});    $.ajax({                 type:'ajax',                 method:'post',                 url:url,                 datatype:'json',                 success:function(response){                  },                 error:function(response){                  console.log(response);                 }               })   }) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -