Json 和 Jsonp 有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24349907/
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 Is Difference Between Json and Jsonp?
提问by Maulik Anand
I am trying to access cross origin site via script.
我正在尝试通过脚本访问跨源站点。
So I am getting an error, I have searched on internet that shows the solution is the JsonP.
所以我收到一个错误,我在互联网上搜索显示解决方案是JsonP.
Anyone Please help me to know what is jsonp .
任何人请帮助我知道什么是 jsonp 。
and what is the difference between json and jsonp.
json 和 jsonp 有什么区别。
Is JSONP cross browser compatible? can i use jsonp in mobile applications or asp.net mvc?
JSONP 跨浏览器兼容吗?我可以在移动应用程序或 asp.net mvc 中使用 jsonp 吗?
回答by faridcs
JSONP is a simple way to overcome browser restrictions when sending JSON responses from different domains from the client.
当从客户端发送来自不同域的 JSON 响应时,JSONP 是一种克服浏览器限制的简单方法。
But the practical implementation of the approach involves subtle differences that are often not explained clearly.
但是,该方法的实际实施涉及通常无法清楚解释的细微差别。
Here is a simple tutorial that shows JSON and JSONP side by side.
这是一个并排显示 JSON 和 JSONP 的简单教程。
All the code is freely available at Github and a live version can be found at http://json-jsonp-tutorial.craic.com
所有代码都可以在 Github 上免费获得,并且可以在http://json-jsonp-tutorial.craic.com上找到实时版本

