【发布时间】:2011-10-06 12:17:35
【问题描述】:
所以我有以下代码:
var formData = new FormData();
formData.append("title", document.getElementById("title").value);
formData.append("html",my_html);
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://www.mywebsite.com/index");
xhr.send(formData);
xhr.onreadystatechange = function() {
// If the request completed, close the extension popup
if (req.readyState == 4)
if (req.status == 200) window.close();
};
服务器应该以 JSON 格式发回响应。 如何检索并将其存储在变量中?
【问题讨论】:
标签: javascript html http-post