tags:

views:

24

answers:

3

hey guys

i need to load an external html page in my codes

$(document).ready(function(){$("#check").load("http://www.mysite.com/names.html")});

and i need my script reads this external html page

is it possible to do such a thing in jquery or even in php ?!

i need to know all of the possible ways .

A: 

Using .ajax instead of .load

$.ajax({
  url: "http://www.mysite.com/names.html",
  cache: false,
  success: function(html){
    //Do some thing with html
  }
});

See more: http://api.jquery.com/jQuery.ajax/

Minh Nguyen
Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol - From the page you linked.
Gazler
A: 

If the page you require access to resides on an external server then you will have to proxy it via your local server using curl. Demo and Documentation here. You then make your AJAX call to your curl page.

Gazler
A: 

Well, what about using cURL on PHP side and returning it to the page via Ajax?

cypher