0
我在我的http中使用以下函數重定向到一些具有POST數據信息的URL。我需要將uuid1附加到新的url中,並將用戶重定向到帶有uuid信息的新頁面http://localhost:8080/my_new_page.html。POST數據並重定向到一個url JavaScript
我能夠看到POST數據的響應代碼200,但它沒有被重定向,當數據很大時,無法將樣式表加載到我的新網址中。
我無法找到非重定向我的網址的原因。請幫助。
<input type="button" value="Click here to go back" onclick=postdata1(uuid1,respData);>
function postdata1(uuid1,respData) {
var iframe = document.createElement("iframe");
var uniqueString = "respData";
document.body.appendChild(iframe);
iframe.style.display = "none";
iframe.contentWindow.name = uniqueString;
var form = document.createElement("form");
form.target = uniqueString;
form.action = 'http://localhost:8080/my_new_page.html?uuid='+uuid1;
form.method = "POST";
var input = document.createElement("input");
input.type = "hidden";
input.name = "RespData";
input.value = respData;
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
'uuid1'和'respData'在你的代碼中的任何地方聲明? – artur99
是的。他們是。我也嘗試在控制檯上獲取他們的輸出。它在那裏歸還它們。 –