Jquery attr() funciton returning "undefined" for GetCapabilities Request

المشرف العام

Administrator
طاقم الإدارة
On my webpage where I am displaying my maps, I want to add a link to the metadata of the selected map. I have specified the link in GeoServer in the MetaDataURL field, and should be able to retrieve it with a GET request and finding it in the XML(See below for XML and Jquery code)But every time I test it I get "undefined"...which is very strange, it seems as if the attribute doesn't even exist. Does anyone have a clue why it returns "undefined"

$.ajax({ type: "GET", url: "http://fast.openearth.eu/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities", dataType: "xml", success: function(xml) { $(xml).find('Layer').each(function(){ if ($(this).children("Title").text() == layer.name) {MetaDataURL = $(this).children("MetadataURL").children("OnlineResource").attr("xlink:href");}});}}); Global:wcmc-010-mangroveusgs2011Mangrove USGS2011Giri C, Ochieng E, Tieszen LL, Zhu Z, Singh A, Loveland T, Masek J, Duke N (2011).
Status and distribution of mangrove forests of the world using earth observation
satellite data. Global Ecology and Biogeography 20: 154-159. URL:
http://onlinelibrary.wiley.com/doi/10.1111/j.1466-8238.2010.00584.x/abstract ;
http://data.unep-wcmc.org/datasets/4wcmc-010-mangroveusgs2011text/plain

أكثر...
 
أعلى