使用 JSONP 与 .net 对话的 JQuery 有哪些很好的例子?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/448879/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are some good examples of JQuery using JSONP talking to .net?
提问by Bravax
As the question says, what are some good examples (or just examples really), of Jquery using JSONP to talk to a .net page or webservice?
正如问题所说,Jquery 使用 JSONP 与 .net 页面或网络服务对话有哪些好的例子(或只是例子)?
I'm attempting to write a page which uses JQuery to call another website (Thus I need to use JSONP) which hosts the webservice/webpage (either is fine), and I can't find a good example of this.
我正在尝试编写一个页面,该页面使用 JQuery 来调用另一个网站(因此我需要使用 JSONP),该网站托管了 webservice/网页(两者都可以),但我找不到一个很好的例子。
回答by redsquare
JSONP is just json wrapped inside a js method. jQuery provides the method name as a callback parameter on the querystring which the jsonp endpoint must then take and wrap the json in then send the response back. The server side language really is irrelevant.
JSONP 只是包裹在 js 方法中的 json。jQuery 提供方法名称作为查询字符串上的回调参数,然后 jsonp 端点必须采用该参数并将 json 包装在其中,然后将响应发回。服务器端语言真的无关紧要。
& a few articles below
和下面的几篇文章