如何使用jQuery读取外部HTML页面? [英] How to read an external html page using jquery?

查看:579
本文介绍了如何使用jQuery读取外部HTML页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.ajax函数从外部页面读取数据. 我无法阅读该页面,但由于访问控制允许来源而出现异常. 我想在我的页面中显示另一页面的数据,甚至设置crossdomain:true,但有帮助

I am using .ajax function to read data from an external page . I am not able to read the page and I get the exception as Access Control Allow origin. i want to show the data of another page in my page I even set crossdomain:true but it dint help

  $.ajax({
type: "GET",   url: myurl,
dataType: "html",
 crossDomain:true,
success:parsehtml});

如何使用jquery读取外部html页面?

How to read an external html page using jquery ?

推荐答案

大多数现代浏览器中的基础Javascript引擎不允许跨域事务.您将必须使用服务器端语言(例如PHP)来执行此操作. Mozilla对这个问题有相当不错的描述.

The underlying Javascript engines in most modern browsers don't permit Cross-Domain transactions. You will have to use a server-side language such as PHP to do this. Mozilla has a fairly decent description of this issue.

这篇关于如何使用jQuery读取外部HTML页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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