Skip to content

Commit

Permalink
test markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
CYH1426 committed Nov 13, 2023
1 parent 3e09dab commit c0e2718
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/join/Markdown editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@
// 创建一个 FormData 对象,用于上传文件
var formData = new FormData();
formData.append("markdownFile", blob, "document.md");
var dataToSend = "Hello, Server!";
// 发送 POST 请求将文件上传到后端
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost:8080/receiver//GetMdServlet", true);
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.open("POST", "http://localhost:8080/receiver/uploadServlet", true);
xhr.setRequestHeader("Content-Type", "multipart/form-data");
xhr.onload = function() {
if (xhr.status === 200) {
// 上传成功,可以在这里处理后端返回的响应
Expand All @@ -73,7 +72,7 @@
console.error("File upload failed");
}
};
xhr.send(markdownContent);
xhr.send(formData);
});
});
</script>
Expand Down

0 comments on commit c0e2718

Please sign in to comment.