양식을 (자바 스크립트로) 게시하고 응답을 기다리지 않으려면 어떻게합니까? 이것이 가능합니까? 내가 만들고자하는 패턴은 일종의 "Fire and Forget"패턴입니다.응답을 기다리지 않고 양식을 게시하는 방법
var iframe = document.createElement("iframe");
var unikString = "UNIQUE STRING";
document.body.appendChild(iframe);
iframe.style.display = "none";
iframe.contentWindow.name = unikString;
var form = document.createElement("form");
form.target = unikString;
form.action = "[THEURL]";
form.method = "POST";
document.body.appendChild((function(){
document.createElement("input");
input.type = "hidden";
input.name = "NAME";
input.value = "VALUE";
return input;
})());
setTimeout(function()
{
form.submit();
}, 0);
(. 내가 도메인 외부의 끝 지점에 게시해야하기 때문에 양식 게시이 방법을 수행, 따라서 CORS 문제가 극복해야 함)
async와 함께 Ajax 사용 : true – Amy
아약스는 어떻게 처리합니까? –
http://stackoverflow.com/questions/5750696/how-to-get-a-cross-origin-resource-sharing-cors-post-request-working – Amy