I'm using $.ajax to post two form select values and trigger a reinstall event, but I cannot pass the Form Data values.
This is my click.function
$('button.submitForm').click(function (event) {
event.preventDefault()
var form = $(this.form)
var formCont = new mgFormControler(form.attr('id'))
var formData = formCont.getFieldsData()
$.ajax({
url: form.attr('action') +
'&loadData='+ form.attr('index') +
'&namespace='+ form.attr('namespace') +
'&index='+ form.attr('index') +
'&ajax=1' +
'&mgformtype=' + form.attr('mgformtype'),
type: form.attr('method'),
processData: false,
contentType: false,
data: formData
}).done(function (data) {
console.log(form.attr('id'))
console.log(form.attr('namespace'))
data = data.data
if (data.status === 'success') {
console.log(data.status + ': ' + data.message)
} else {
console.log(data.status + ': ' + data.message)
}
});
});
});
The header in dev.tools (first image) shows that formData passes as object in Query String Parameters,
but I want to pass it as a separated element (second image)
I tried new FormData() but I always get the same result with object (first image).
