getjson to xml function

biji_serok1

New Member
I am beginner at this and am searching for 1 day to resolve this issue.SoI have a ID ex: 1953 and a external website that holds more info about my id:eternalwebs1te/id=1953&xml the result is a xml that looks like this:\[code\]<site> <item id="1953"> <name> <![CDATA[ Name I want to get ]]> </name> </item></site>\[/code\]I made a funtion to try and get the name of the id I have:\[code\]function itemname(itid) {link1 = "externalwebs1te/id="+ itid + "&xml&jsonp=?";$.getJSON(link1, function(obj1) {xmlDoc=loadXMLDoc(obj1);return (xmlDoc.getElementsByTagName("name")[0].childNodes[1].nodeValue);}); }\[/code\]When I look at the Net tab in firebug, it show the GET id=1953 ok, and I can can see the XML, but don't have any idea why the itemname function doesn't return the name.I knowledge in JS is limited.I tried to save the contents of the xml link in a xml file, and it works with the code:\[code\] xmlDoc=loadXMLDoc("item.xml");alert (xmlDoc.getElementsByTagName("name")[0].childNodes[1].nodeValue);\[/code\]Ty Danny
 
Top