Any ideia how to upload File (.pdf) from ajax to django backend ?
customerForm.addEventListener('submit', e => {
e.preventDefault()
$.ajax({
type: 'POST',
url: '',
data: {
'csrfmiddlewaretoken': csrf[0].value,
'identity_type': $('#id_identity_type').val(),
'identity_number': $('#id_identity_number').val(),
'file': $('#id_file').val()
},
success: function(response) {
console.log('SUCCESS')
},
error: function(error) {
console.log(error)
}
})
Thank You