Environment
Issue/Symptoms
Sometimes within the header ContentType
an error is thrown as it has not been properly defined. When using JSSPs that the content type is not returning application/json; charset=utf-8
.
To fix this, add ContentType
in JavaScript before the rest of the code is executed.
%
response.setContentType("text/html;charset=utf-8");
%
or
%
response.setContentType('application/json;charset=utf-8");
%
Sample
%
response.setContentType('application/json');
var x = {'Element1':'Element2'};
document.write(JSON.stringify(x));
%