I was debugging my website when I realized that all my form post are receiving 302 response, but it is working fine. The way I handle the POST is through JS, using XMLHttpRequest like this:
HTML
<form method="POST" onsubmit="return submitFn(this)">
JS
submitFn = function(formElement) {
var formdata = new FormData(formElement);
var xhr = new XMLHttpRequest();
xhr.open(formElement.method, "/formaction", true);
xhr.addEventListener('readystatechange', function(e) { ... }
xhr.send(formdata);
return false;
}
As I know, return false avoid HTML POST so I can handle it with JS. Everything works fine BUT when I see "Network Activity" in Debugger Console (Chrome or FF) there is a 302 responde from "formaction" page, is that right? or am I making a mistake?