I am having an issue regarding a page loaded with Ajax.
A javascript withing the page loaded somehow executes twice.
Here is the way page is loaded.
$(this).html("<img src='loader.gif' />").load(page, parameters, function(response){
$(".dynamic_load").html(response).show();
);
Here is the javascript:
$(document).ready(function(){
alert("<?=time()?>");
});
The script alerts two identical values.
Has anyone ever had a similar problem?
SOLVED:
The problem was unnecessary $(“.dynamic_load”).html(response).
Because you’re embedding a PHP generated time value. That value is sent over to your client browser as a fixed value, e.g. your page’s source has
in it, which will never change for the lifetime of the page.