jquery timing with ajax call and html() -
i loading list div via perl in ajax call. once list loaded triggering click on first row:
success: function(data) { $('#newslist').html(data); $("#newslist .editrow").first().trigger('click'); },
but problem timing ... in code above nothing happens.
html() synchronous operation guessed wasn't loaded in time trigger it's job.
to test wrapped trigger line in settimeout of 1000 worked fine. ie first row clicked , associated click worked should.
as there not callback html(), correct way ... timeout not correct way of course.
try using $("#newslist .editrow").delay(1000).first().trigger('click');
Comments
Post a Comment