I'm trying to process a complete function in an ajax call. If the value is undefined, I want cast a var as an empty string. Otherwise, I would like to capture the value into a string array.
The problem is I'm entering the if statement, even when logging the value of the variable in question returns as undefined. What am I missing here?
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
if(typeof $(this).attr("ows_Products") !== undefined) {
console.log($(this).attr("ows_Products"));
arr = $(this).attr("ows_Products").split(',');
}
else {
arr = "";
}
});
}