```
<?
if($_POST['begin'])
{
    while(1)
    {
        echo "1";
        sleep(2);
    }
    die();
}
?>

<span class="answer"></span>

<script type="text/javascript">
$(document).ready(function() {
        $.ajax({
            type: "POST",
            url: "exp.php",
            data: "begin=1",
            success: function(msg){
                $(".answer").html(msg);
            }
        })  
})
</script>

```

It, of course, doesn't work. What should I change to make it work? Can I avoid using setInterval, setTimeout or other functions in javascript?

By the way, what I am trying to do here is to write number 1 every two seconds.