Here:
var node = data.getElementsByTagName( 'overall_average' )[0].childNodes[0]; var rating = node ? node.nodeValue : 'It is empty';
Please note that this code generates an (error) if there is not a single "total_average" element in the data
, so you may need protection from this case, if necessary ...
source share