Using jQuery, what's the best way to set up a polling system?
<p>During a document.ready, I call the "load_result" function outlined below:</p>

<pre><code>function load_result()
{
    $.getJSON( "http://www.mywebsite.com/loadresult.php", function(data) {
        if( data == undefined )
        {
            null_count++;
            return;
        }
        console.log( data );
        insert_result( data );
        setTimeout( "load_result", 500 );

    } );    

}
</code></pre>

<p>However, this works sporadically.. sometimes, it calls <code>insert_result</code> properly, and other times it doesn't. Any tips?</p>
