I am getting sometimes bad response data
or undefined
or null
or empty string
as response. I am checking whether my response is of json before proceeding with further data manipulation.
function response(oResponse, xhr) {
var ct = xhr.getResponseHeader("content-type") || "";
if (ct.indexOf('json') > -1) {
// ...
}
}
I want to check whether the response
is valid
before proceeding. I want to check for invalid responses like "null", "undefined", "emptry string" too along with checking whether the response is json before manipulating the data.