第一次加载后Jquery加载功能卡住了

Hi I have this sample code to load random quotes.

PHP Code:

<?php
  //Selecting Random quotes from database --randomquotes.php
  require('dbconnection.php');
  // $temp=10;
  $sql = "SELECT * FROM db.q order by rand() LIMIT 1";
  $res = mysql_query($sql,$con);
  while ($res1=mysql_fetch_assoc($res))
  { 
    print "<em>".$res1['quote']."</em>";
  }
?>

HTML CODE:

<div class="class_box_shadow_quote">
<?php
  require('randomquotes.php');
?>
</div>

Jquery Code:

<script>
  var $j = jQuery.noConflict();
  $j(document).ready(function(){
    setInterval(function() {
      $j(".class_box_shadow_quote").load('randomquotes.php');
    }, 7000);
  });
</script>

This code is working well for the first time , but is getting stuck on second quote and is not changing the quote. Also everytime i see the second quote to be the same always. What is the problem . Please help?

I believe the output is being cached by jQuery. You can try with caching disabled.

setInterval(function() {
    $j.ajax({
        url: 'randomquotes.php',
        cache: false,
        success: function(data) {
            $j(".class_box_shadow_quote").html(data);
        }
    });
}, 7000);

Try adding a random seed at the end of your URL to avoid browser caching, like so:

    $(".class_box_shadow_quote").load('randomquotes.php?s=' + (Math.Random() * 1000000))