Jump to content

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


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...