I have a form, which has several input types. I am saving the form with AJAX:
function save_form_data(){
$.ajax({
url:"path/to/file.php",
method:"POST",
dataType:'json',
data: $("#options_form").serializeArray(),
success:function(returnObj){
console.log(returnObj);
}
});
}
I am using this function on submit function of jQuery.
$('#options_form').submit(function(event){
console.log('submitted');
event.preventDefault();
save_theme_options();
});
But, the problem that I face is I am not able to get the files uploaded in the form using AJAX request. I try to print $_FILES, but results in an empty array.
How do I solve this issue?