Skip to content Skip to sidebar Skip to footer

Jquery: How To Detect Element That Is Being Loaded Every Few Seconds

I have a div element where a file is being loaded every 10500 miliseconds; index.php ...
... code that loads every few seconds. setInterva

Solution 1:

Your strategy seems to work.

setInterval(
function () {
   $('.loadHere').unload().load('toload.php').fadeIn('slow');

}, 10500);


$(document).on('click','.testbtn',function(event)
{
  event.preventDefault();

 var xyz = $('.hiddenelement').val();

alert(xyz);
});

Here is the working plunker : http://plnkr.co/edit/tiLv3WMDCjoW3Ggb9bTH?p=preview.

Solution 2:

Use Callback function:

$( "#success" ).load( "/not-here.php", function( response, status, xhr ) {
  if ( status == "error" ) {
    var msg = "Sorry but there was an error: ";
    $( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
  }
});

From Jquery Docs

Post a Comment for "Jquery: How To Detect Element That Is Being Loaded Every Few Seconds"