how to take data from form in ajax code example
Example 1: ajax submit form data
$(function() {
$('form.my_form').submit(function(event) {
event.preventDefault();
var form = $(this);
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize()
}).done(function(data) {
}).fail(function(data) {
});
});
});
Example 2: ajax get form data
var form =
var fmData = new FormData();
form.append('name',fmData);
$.ajax({
url:'URL',
type:'POST',
data:fmData,
success:function(){},
error:(er){}
})