1
I have a form that uses Ajax to do the POST in PHP and insert in the database to get the data using Formdata but the textarea inserts empty in the database.
<script type="text/javascript">
function submitForm() {
var myForm = document.getElementById('cadastro_anuncio');
var form = new FormData(myForm);
var plano = $("#plano").val();
if (plano != 1) {
$.ajax({
url: '<?php echo base_url('classificados/minhaconta/cadastrar_anuncio') ?>',
data: form,
type: 'post',
processData: false,
contentType: false,
success:
function (data) {
if (data == 0) {
location.reload();
}
else {
$("#code").val(data)
$("#comprar").submit();
}
}
});
return false;
}
}