【发布时间】:2018-02-01 09:45:52
【问题描述】:
我有一个 html 页面,我在其中编写了一个用于 ajax 调用的 javascript 以下是我的代码
var dbParam = JSON.stringify({"name" :"success"});
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
}
}
xmlhttp.open("POST", "MyServlet", true);
xmlhttp.setRequestHeader("Content-type", "application/json");
xmlhttp.send("x="+dbParam);
MyServlet 是我的 servlet 的 url 模式
在 Servlet 中
String s=request.getParameter("x");
This is returning null
【问题讨论】:
标签: javascript ajax servlets