0
I am getting this error when I try to upload data to the page via Ajax. There is another way to send Json objects from Servlet to JSP without using document.write
?
error: "A parser-blockingis invoked via document.write."
Servlet:
private void recuperarValores(final HttpServletRequest request, final HttpServletResponse response)
throws IOException, Exception {
request.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
PrintWriter out = response.getWriter();
JSONArray jsonArray = new JSONArray();
JSONObject responseObj = new JSONObject();
try{
Escala_DAO e = new Escala_DAO();
List<Escala> procedimentos = e.GetEscalaTotal("2018-01-01", "2018-01-31");
for (Escala obj : procedimentos) {
JSONObject js = new JSONObject();
js.put("jsRe", obj.getRe());
js.put("jsEntra",obj.getEntrada());
jsonArray.put(js);
}
responseObj.put("jsonArray", jsonArray);
out.print(responseObj);
} catch (JSONException e) {
}
}
JSP:
$.ajax({
dataType:'json',
url : './GetValores',
type : 'POST',
success: function(data) {
queryObject = eval('(' + JSON.stringify(data) + ')');
queryObjectLen = queryObject.jsonArray.length;
for(var i=0;i<queryObjectLen;i++){
var inicio = +new Date(queryObject.jsonArray[i].jsEntra);
var fim = +new Date(queryObject.jsonArray[i].jsSai);
var content = "Jovani";
dados.push({
'start': inicio,
'end': fim,
'content': content,
'className': 'green'});
}
},
error: function() {
alert("Ocorreu um erro na requisição ajax");
}
});
Where would the
document.write
?– Sam