I am trying to submit a form that contains both text and files and I am trying to use POST method in AJax but first it kept saying that Post method is not supported then now it shows me this
jquery.min.js:4 POST http://localhost:8000/register/ 400 (Bad Request)
(I am using django and python for the backend )
Here is my code
$("form#formdata").submit(function(){
var formData = new FormData($(this)[0]); $.ajax({ url: "http://localhost:8000/register/", type: 'POST', data: formData, done: function (data) { alert("Done") }, cache: false, contentType: false, processData: false, }); return false; });
Aucun commentaire:
Enregistrer un commentaire