I'm creating an application that has a form with all types of inputs... My problem is when I'm using serialize() it doesn't include the input type file. so how do I send the file to the backend (PHP) using serialize()? And also I don't want to use FormData(). If there is any way please help me...
//register.php
$.ajax({
url: "ajax/user.ajax.php",
type: "post",
dataType: "JSON",
data: {
formData: $('#registrationForm').serialize()
},
success: function(response) {
console.log(response);
},
});
//user.ajax.php
<?php
require_once (__DIR__."/../include/config.php");
parse_str($_POST['formData'], $_POST);
?>
Error:Failed load response data