jQuery ajax无法正常工作吗?

Can anyone see why this jQuery ajax isn't working? It's supposed to run every second, but it isn't running at all.

Source code:

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{

var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="moreajax.gif" />');

$.ajax({
type: "POST",
url: "ajax_more.php",
data: "lastmsg="+ ID, 
cache: false,
success: function(html){
$("ol#updates").prepend(html);
$("#more"+ID).remove();
}
});
}
else
{

}


return false;

}, 10000);

try removing the:

return false;

also you have the setInterval to run every 10000 ms which is equal to 10 seconds.

var ID = $(this).attr("id");

In the context you've provided $(this) will resolve to an empty set. Thus your later check if(ID) will always be false.

You should pass an actual selector to $() to select the dom element you want to get the ID of.