简体   繁体   中英

how to Call Restful web service using javaScript?

I have Restful webservice return data in xml style I but url in browser like :

 http://localhost:3085/BasicService.svc/sess_details?subject = 999 

it gaves me

 <subjectDetails xmlns="http://schemas.datacontract.org/2004/07/CA_WCF" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <CommitteeId>121</CommitteeId> <IsCommittee>true</IsCommittee> <Name>new employees</Name> <Number>six</Number> <subjectDate>10/02/1434</subjectDate> <subjectId>999</subjectId> <Status>5</Status> <UserId>0</UserId> </subjectDetails> 

How to call webservice and store result ( this xml data ) in javascript variable ?

You convert the returned XML to JSON which you can store in a variable.

http://goessner.net/download/prj/jsonxml/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM