Jump to content

How Can I Load The Contents Of A <div> From Another Domain Inside My Website?.


Eyad Syria-lover

Recommended Posts

Hello.

Let's Say That I Have Two Sites,The First One Is http://site1.com , And The Second One Is: http://site2.com , The First Site index's File Got A <div> Element With id="one" , And The Second Site index's File Got A <div> Element With id="two" ,The Question Is:

How Can I Load div#one Contents Inside div#two ?

I Don't Want To Use Frames.

I've Read About jQuery load() Method On W3schools , But It Doesn't Seems To Give An Example About My Case.

Sorry For The Prolongation.

Link to comment
Share on other sites

Javascript is restricted to only loading data from the domain name it is running on. If the other site sends a header specifically indicating that cross domain requests are allowed then you can load the content from the other domain.

 

To guarantee it will work for any domain you will have to use PHP's curl library.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...