如何将数据从一个域检索到其他域(跨域) [英] How to retrive data from one domain to other (Cross-domain)

查看:107
本文介绍了如何将数据从一个域检索到其他域(跨域)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求就像我有一个网站abc.com,我的数据库在xyz.com



现在我必须从xyz回溯abc.com上的数据.com



我尝试过xmlhttp,即使在使用跨域策略XML后也无法正常工作



使用JSON,我无法理解该过程的结构,xyz.com上的代码是什么以及abc.com上的内容



有人可以提供我吗?一步一步的指南?



谢谢



mahesh

解决方案

对于跨域,您必须使用JSONP而不是JSON。请参阅下面的详细信息



这里有很好的文章供您参考



http://encosia.com/use-asp-nets-httphandler-to-bridge -the-cross-domain-gap / [ ^ ]



http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/跨域-jsonp-with-jquery-call-step-by-step-guide.aspx [ ^ ]



以下是很好的PHP文章,



http://www.geekality.net/2010/06/27/php-how-to-easily-provide-json-and-jsonp/ [ ^ ]

http://www.w3resource.com/JSON /JSONP.php [ ^ ]

My requirement is like i have a website abc.com and my database is on xyz.com

Now i have to retrive data on abc.com from xyz.com

I have tried xmlhttp, even after putting cross domain policy XML it is not working

with JSON, i am not able to understand the structure of the process, what will be the code on xyz.com and what on abc.com

Can someone provide me a step by step guide?

Thanks

mahesh

解决方案

for the cross domain you have to use the JSONP instead of JSON. Please see below for more details

Here is the nice articles for your reference

http://encosia.com/use-asp-nets-httphandler-to-bridge-the-cross-domain-gap/[^]

http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx[^]

Here are the good PHP articles,

http://www.geekality.net/2010/06/27/php-how-to-easily-provide-json-and-jsonp/[^]
http://www.w3resource.com/JSON/JSONP.php[^]


这篇关于如何将数据从一个域检索到其他域(跨域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆