2

I am trying to update my div with ajax and jquery. The ajax request is performed correctively and the database is updated, the div is not reloading however.

The methode update(ajax) is called, however. The $stats div is not updating. Can anyone help me out please? Directly calling the stats.php file DOES display the correct html output.

EDIT: code snippets removed.

user1390504
  • 183
  • 4
  • 15
  • Don't forget the closing `tr`-tag in the `while`-loop, but this will not solve your main issue. – scessor May 12 '12 at 10:01
  • 1
    Have tried to call directly `stats.php`? Is there any error? – bitoshi.n May 12 '12 at 10:05
  • You html is not valid if you have an opening `tr` with no closing one. The most browsers can repair such html so you don't need to add it, but it is invalid and dirty. But like I said before, this will not solve your main issue. Can you show us your whole html? – scessor May 12 '12 at 10:43
  • Alright, thanks for pointing that out. I have fixed it and I'm about to upload all my files, so you can have a closer look. Thanks for the quick reply! – user1390504 May 12 '12 at 11:01

1 Answers1

2

Using prototype and jQuery at the same time can create conflicts because both use the $ (also see Using jQuery with Other Libraries). You should call jQuery.noConflict(); directly after inserting jQuery and use $ only for prototype, for jQuery use jQuery instead:

Add directly after <script type="text/javascript" src="js/jquery.js"></script> in the index.php:

<script>
     jQuery.noConflict();
</script>

And replace in the script.js the update function with:

function update(ajax){
    jQuery("#stats").load("stats.php");
}
scessor
  • 15,995
  • 4
  • 43
  • 54