Jump to content

Display the contents of a third party website page in a div


lynxus

Recommended Posts

Hi guys,

 

Please help :)

 

Im trying to display the output of a php file on a normal html page.

 

For instance, i have

index.html with a div, Inside that div i want the page to load data.php from another server and display it in the index.html page.

 

Basically it so data.php generates a normal table with soem data in, I need to insert that table into index.html ( thats on another server )

 

Ive tried <script language="javascript" src="http://blaaa.com/data.php"></script>

 

But nothing happens..

 

Am i doing something wrong? is my .php script outputting the format wrong?

 

 

Thanks

G

 

<script language="javascript" src="http://blaaa.com/data.php"></script>

 

will do nothing unless data.php outputs valid javascript. <script> runs scripts, as opposed to inserting html files into the page.

 

Have you tried an iframe?

<iframe src="http://blaaa.com/data.php"></iframe>

 

 

 

 

Either would work.

 

On the one hand, iframes don't autoscale according to their content, so a document.write might be better. On the other hand, making sure you've escaped quotation marks properly can get rather complicated when you're outputting html through javascript through php.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.