function load_result()
{
$.getJSON( "http://somesite.com/loadresult.php", function(data) {
if( data == undefined || data == null )
{
console.log( "no data" );
clearTimeout( lr_timeout );
lr_timeout = setTimeout( "load_result()", 2000 );
return;
}
insert_result_price( data );
clearTimeout( lr_timeout );
lr_timeout = setTimeout( "load_result()", 50 * ( Math.random() * 10 ) );
} );
}
and lr_timeout
is defined globally and the load_result
function is kicked off initially in the document.ready
function. The problem is that the function doesn't always run. I'll watch it in Firebug and I have another function that's set on a setInterval that always works.
Ideas?