So I'm having a huge brain fart here and I know for a fact I am going about this the wrong way. Unfortunately, I can't refer to previous work I've done where I have done this correctly as I no longer have access to them.
I have my index page grabbing information from different PHP pages then displaying them on screen. The reason why it's grabbing them from different PHP pages is because some times, these scripts will fail. If this was all in the same page, it would cause the whole page to fail so I want to call each bit individually so if one fails, it doesn't cause the whole thing to fall over, only that part fails. This works with both object and iframe like so:
<object data="./include.php" type="text/html"> <p>There was a problem loading the record.</p> </object> <iframe src="./include.php"> <p>There was a problem loading the record.</p> </iframe>
While this does work, the problem is that neither iframe nor object has a dynamic height. Using PHP include or require will display the content at an effective dynamic height but the problem there is that with require, if the included file fails the whole page fails and with include, if there's an error then the rest of the page will stop loading.
The ideal solution (which I think would be using JSON?) would work similar to include but load it asynchronously and if it returns an error (500 or otherwise) display a friendly message like above. The height needs to be dynamic so that it doesn't have its own scrollbar. I only want the scrollbar of the main page.