how can get attributes (rows) of root (data) element in jq
Try
var records = $(xml).find("data").attr("rows");
If it is a root node, use .filter()
instead of .find()
.
var records = $(xml).filter(":first").attr("rows");
jQuery's .find()
selects by searching inside the root nodes, while .filter()
selects from among the root nodes.
This might not be working because it is having trouble finding the first element using the query you specified. This might be of some use to you:
selecting root element in jquery
After that .attr("rows") should work.