How to continue to use the value to function? Even setTimeout?

$(document).ready(function() {
    product_online(<?=$prodIdForOnline;?>, "<?=$urlForOnline;?>");
    product_update_online(<?=$prodIdForOnline;?>, "<?=$urlForOnline;?>");
  });

  function product_online(id, url){
    $("-sharpproduct_online").load("/models/notify?type=product-online&url="+url+"&id="+id, function(data){
    });
    setTimeout(product_online, 15000);
  };

  function product_update_online(id, url){
    $(".product_online").load("/models/notify?type=product-update-online&url="+url+"&id="+id, function(data){
      console.log("updated");
    });
    setTimeout(product_update_online, 10000);
  };

this is the code I have completed.
at the beginning of ready, I will check the value for function to use
, but it will not be worth it after the setTimeout is exceeded. I know it is because the function of setTimeout faces does not have a value correlation
so how to change the value of ready and then enable function when setTimeout is in progress?!?


setTimeout (code, milliseconds, param1, param2) / / ie9+

or


setTimeout, :

function foo(id) {
    console.log(id);
    setTimeout(function() {foo(id);}, 1000);
}
Menu