Posted on 2011-02-24
I have a function that calls ajax to load contents of a class into a div element. When I set this function to activate from a button on the page, it works as it should. <input type="button" value="load class" onclick="allOpen()" />
This works ok as the button is on the actual page that the div is on so ajax returns the content into that div. My problem is, I only want this function to run once the page is loaded so I have put the code on another button that actually loads this page, That button looks like this...
<input type="button" value="Classes" onclick="loadContent('classes')" />
When that button is clicked, it causes php to include another page called "classes.php". So far so good. But when I add the other function to this button (allOpen()), it does nothing. Here is the modified button.
<input type="button" value="Classes" onclick="loadContent('classes');allOpen()" />
Here is the allOpen function.
// and the displayResults()
var mod = document.getElementById('mod-results');
mod.innerHTML = result;
document.getElementById('results').style.display = "inline"; // displays the contents of search_classes.php