PHP / AJAX更新mysql更新页面

I need a script that can check if a new row is inserted, and then return back to the main page, to load another page with ajax.

Right now I do it every x secs, which is not optional in this case:

 function refresh()
 {
      $("#conent").load("ajax.php");
  }

  setInterval('refresh()', 3000);

So how do i make the following: Whenever the mysql database is updated, it need to check it and return and load $("#conent").load("ajax.php");