要求使用jQuery阿贾克斯外部网站的数据 [英] Request external website data using jQuery ajax

查看:105
本文介绍了要求使用jQuery阿贾克斯外部网站的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着读了这件事,真的不知道从哪里开始,所以希望有人可以点我朝着正确的方向。

I've tried reading up about this and not really sure where to start, so hoping somebody will be able to point me in the right direction.

基本上我试图使用jQuery AJAX读取外部网站和检索,从它的链接列表。没有特别的原因,因为这样的时刻,只是想看看我是否可以用做挑战自己。

Basically I'm trying to use jQuery ajax to read an external website and retrieve a list of links from it. No particular reason as such at the moment, just wanted to see if I could challenge myself by doing it.

在这样做时,我读了一些关于同源策略,并理解它(在某种程度上),但可以做一些指点。

In doing so I've read up a little about the Same Origin Policy and understand it (sort of) but could do with some pointers.

这是可能的吗?我一直在寻找使用凯特·斯帕诺斯的拼字游戏点计算器,例如,她的jQuery的code含有这似乎检查字典网站和工作部分,输出的一些Ajax。

Is this possible to do? I've been looking at the scrabble points calculator used by Kate Spanos, for example, and her jQuery code contains some ajax which appears to check dictionary websites and work on some of the output.

可能有人点我在正确的方向,还是我找错了树,它是基本上不可能做没有一些其他的技术知识。

Could somebody point me in the right direction, or am I barking up the wrong tree and is it basically impossible to do without some other technical knowledge.

谢谢, 垫

PS我是个'菜鸟',所以请尽可能温和。我们每个人都有这个东西开始的地方,所以请不要拍我失望...在此先感谢。

PS I am a 'noob', so please be as gentle as possible. We all have to start somewhere with this stuff so please don't shoot me down...Thanks in advance.

推荐答案

您应该考虑JSONP,或更可能使用某种中介,如使用卷曲或的file_get_contents进入第三PHP脚本(因此同一产地)党的网站

You should look into JSONP, or more likely use some sort of intermediary, like a PHP script (so same origin) that uses cURL or file_get_contents to access the third party site

例如:

<?php
$file=file_get_contents('http://some_domain_not_yours.com/somefile');
echo $file;
?>

这篇关于要求使用jQuery阿贾克斯外部网站的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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