I am trying to handle the full function in an ajax call. If the value is undefined, I want var var to be an empty string. Otherwise, I would like to write the value to an array of strings.
The problem is that I enter the if statement, even when the value of the variable in question is logged, it 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 = "";
}
});
}
source
share