If you are having trouble showing fresh content from PHP/MySQL in AJAX, try this out!
First, you must obviously include JQuery lib.
Then, using Jquery set an AJAX load in your View or Template:

<script type="text/javascript">
(document).ready(function() {

     $("#element").load("stuff.php?idea");

});
</script>

<div id="element"></div>

Then get the php file you are loading, in this case its stuff.php, and create a get request for the value passed in the URL, which is 'idea'.

if (isset($_GET['idea']))
{
  echo 'Ajax is working';
  //
  // All your functions in here
  //
  exit; // Make sure to exit so nothing else processes.
}