开发者

How to read an external html page using jquery?

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});

How to read an external html page using jqu开发者_StackOverflow社区ery ?


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.


There is one solution without using any server side technologies. Please see this http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-cross-domain-ajax-request-with-yql-and-jquery/

You may have to process the returned output to suit your need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜