I am using ajax call to append html to a jsp page from a servlet where i am outputting a string of html using response writer. The ajax call looks like this -
$(document).ready(function(){
$.ajax({
type:"GET",
url:"form/view",
data: "",
cache:false,
success: function(data)
{
$("body").append(data);
},
error: function(data,status,xhr)
{
$("body").append("error ");
},
crossDomain: true,
async: false,
});
})
The call seems to work flawlessly in firefox but appends "error" in chrome. The servlet code looks like this
PrintWriter out = response.getWriter();
response.setContentType("text/plain");
out.println(html);
out.close();
Where html is a string dynamically created from database.