【发布时间】:2013-12-05 08:05:53
【问题描述】:
我正在尝试通过 jquery ajax 使用 http post 方法将数据发送到服务器。
客户端javascript的代码在这里。 (jquery版本为v1.7.1)
$.ajax({
type : "POST",
async : false,
url : "/my/context/and/path.html",
data : "key1=value1&key2=value2",
dataType : "json",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
cache : false,
crossDomain: true,
success : function(data) {
alert("success");
},
error : function(xhr, textStatus) {
alert("error");
}
});
服务器端代码在这里。
@RequestMapping(value="/my/context/and/path.html")
public void createSomeData(
MyVo myVo,
HttpSession session,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
logger.debug("user id -vo : " + myVo.getUserId());
logger.debug("user id -request : " + request.getParameter("userId"));
}
当我将 Mac 与任何浏览器一起使用时,它都能正常工作。 (记录器写入适当的用户 ID)。 即使我使用的是 Windows 7,它在 IE8 上也能正常工作。
但是问题是我使用的时候请求参数没有传递 Windows7 上的 chrome 或 firefox。
此外,我必须在其中部署相同的 Web 应用程序的环境。 一种是使用 https,另一种是使用 http 作为 Web 服务器。
我之前提到的问题只发生在使用 https(SSL) 的 Web 服务器上。
谁能帮我解决这个问题。
提前致谢。
【问题讨论】:
标签: ajax spring google-chrome post https