Accessing web Service from jQuery - cross domain

前端 未结 4 580
广开言路
广开言路 2020-11-30 00:52

I am trying to acess a wcf service from a jQuery client

Specifically this example http://www.codeproject.com/KB/aspnet/WCF_JQUERY_ASMX.aspx#4

All works well

4条回答
  •  悲&欢浪女
    2020-11-30 01:20

    You might want to check out JSONP (JSON with Padding). In short, it involves adding a script element to the page with the web service url as the src. The web service then wraps the JSON as the first argument in a callback function, which is executed when the script is parsed.

    Script elements are exempt from the Same Origin Policy, which is how they are able to get around this issue..

提交回复
热议问题