Hi all,
I'm new to jQuery and also pretty green with JS, but not bad at PHP etc.
I have a site which unfortunately isn't exposed on the net so I can't directly link you to it. I'll try to explain the problem though.
My page uses the following routine to load a separate PHP page into a DIV:
function display_table() {
var ajaxurl = "./includes/modules/sec0020/sec0020table.php?page="+page+"&loc="+loc+"&scol="+scol+"&fcol="+fcol+"&filter="+filter;
$.ajax({
url: ajaxurl
}).done(function(data) {
$('#sec0020-2').html(data);
maxpage = $('#sec0020-2').find('#page-count').html().split(" of ").pop();
$("tr:contains('text')").trigger("click");
});
}
This works fine and via divs triggering code I can navigate pages loaded etc.
However when the page is fully loaded I want to do the following:
$("tr:contains('text')").trigger("click");
so it finds a <tr> which contains 'text' and triggers a click event on it. Note this is within the ajax loaded page.
The problem is I'm finding its totally random whether it actually does the trigger or not. It might to it the first time it loads the sub-page. I think click a control which navigates the sub-page to page 2, then page to page 1 and it doesn't do it, yet if I goto page 2 then back to page 1 again it does do it!
I'm guessing it is to do with the timing of the subpage being loaded or rendered but I'm not 100% sure.
Help please! Thanks in advance,
Chris.