Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  61] [ 6]  / answers: 1 / hits: 21036  / 15 Years ago, fri, january 1, 2010, 12:00:00

Hi there (& Happy New Year!)



Are there some examples on how I can use JQUERY to get XML from a remote REST API and just display the XML? I just need a little assistance to get things going.



Request Details:



https://{username}:{password}@api.opsourcecloud.net/oec/0.9/myaccount 


Response Details:



<?xml version=1.0 encoding=UTF-8 standalone=yes?> 
<ns3:Account xmlns:ns2=http://oec.api.opsource.net/schemas/organization .. >
<ns3:userName>rdyer</ns3:userName>
<ns3:fullName>Joe Public</ns3:fullName>
<ns3:firstName>Joe</ns3:firstName>
<ns3:lastName>Public</ns3:lastName>
<ns3:emailAddress>[email protected]</ns3:emailAddress>
<ns3:orgId>1831c1a9-9c03-44df-a5a4-f2a4662d6bde</ns3:orgId>
<ns3:roles>
<ns3:role>
<ns3:name>primary administrator</ns3:name>
</ns3:role>
</ns3:roles>
</ns3:Account>

More From » jquery

 Answers
83

Use the jQuery.get method.



For example:



$.get(
'https://{username}:{password}@api.opsourcecloud.net/oec/0.9/myaccount',
function(data) { alert(data); }
);





EDIT: For security reasons, you cannot use AJAX to get data from a different domain. Therefore, you'll need to write a server-side script to get the data from the other domain, then call that using $.get.


[#97944] Monday, December 28, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cristinadomoniquel

Total Points: 320
Total Questions: 94
Total Answers: 94

Location: Moldova
Member since Sat, Aug 6, 2022
2 Years ago
cristinadomoniquel questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
Mon, Nov 23, 20, 00:00, 4 Years ago
Mon, Aug 17, 20, 00:00, 4 Years ago
;