我正在尝试使用jQuery通过Ajax POST请求发送一些图像,但是我遇到了400个错误的请求错误。
这是我的代码:
function sendImages(param, dados){
var p = document.getElementById('frm:p').textContent;
param = param + "_" + p;
$.post('/app_context/Servlet/' + param, dados, function(data,status,xhr){
if(data === 'END'){
doThis();
}
});
}
js文件像这样导入,全部在h:head / h:head:
中<meta name="copyright" content="some text here"/>
<link href="#{facesContext.externalContext.requestContextPath}/css/primefaces.css" rel="stylesheet"
type="text/css"/>
<link href="#{facesContext.externalContext.requestContextPath}/css/style.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico"/>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head"/>
<script src="#{facesContext.externalContext.requestContextPath}/js/default.js" type="text/javascript"></script>
在Chrome控制台中,打印出来: