$.getJSON gets, well, JSON data...  it doesn't handle XML data....

you can use the generic $.ajax method (which $.getJSON ultimately uses
anyways, but just with the tpye set to JSON) and handle the data in
the callback event

On Jan 4, 4:06 pm, Simon <simon....@rewardstream.com> wrote:
> Hi there.
>
> I'd like to use jQuery to access a remote website that has a REST API
> which returns XML data.
>
> Should I be able to use the jQuery.getJSON request to do it or is
> there another command since it's returning XML.
>
> Example Request Details (HTTP GET):
>
> https://{username}:{passwo...@api.opsourcecloud.net/oec/0.9/myaccount
>
> Example 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>jpublic24...@pop.net</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>

Reply via email to