简体   繁体   中英

How to access hosted WCF webservice with jquery in html

1.I have a simple WCF webservice , say hello method that return string "hello". I have hosted it on a server. Say I can access it as http://demo.test.com/myservice/Service.svc?wsdl .

2.I want to access it through simple html page with jquery call.

The problem is that html page is not being able to access the service. I haven't added anything on service except whatever comes in default with visual studio 2010. Do I need to add anything on the server side service to access them with jquery call? How can I be able to access them?

Is service running on same domain as page with JavaScript code?

If not you need to enable CORS http://en.wikipedia.org/wiki/Cross-origin_resource_sharing to make AJAX requests to other domain

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