0

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 jquery ?

2
  • Is the page outside of your domain? Also, you should accept some answers to your other questions if you've found them to be useful. It will help you get more answers. Commented Jun 13, 2011 at 5:42
  • yes the page is outside my domain. Commented Jun 13, 2011 at 5:55

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I cannot use PHP I want to get the contents using jquery only . is there a way that I get the contents of the page.
@Rishabh no - it is not allowed. You will need to use PHP, ASP, ColdFusion, or something else.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.