AJAX에서이 양식을 "POST"로 만들려고합니다. 그러나 서버를 사용할 때 사용자가 아무 것도받지 못하면 제안을로드하지 않습니까? jQuery를 설정할 수 있도록 FormData가 AJAX와 작동하지 않습니다
이
은<form method="POST" action="/ajaxpost">
<input type="text" name="user"/>
<input type="submit" value="SEND"/>
</form>
//here trying to do the same form but ajax, I have this button that calls the function "sendAjax()"
<input type="submit" value="SEND"/>
//The function this does not work. fail data to the server
function sendAjax(){
// HTML5 form data object.
var fd = new FormData();
fd.append("user", 'JOAN FREDO USERNAME');
$.ajax({
url: '/ajaxpost',
data: fd,
contentType: 'application/x-www-form-urlencoded',
processData: false,
type: 'POST',
success: function(data){
alert(data);
}
});
}