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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -