I've got a page that I'm loading via ajax, and the first time I load
the page, the click function works great.
If I make a second ajax request and load new data, the clicks are
triggering the function twice.
Even though I empty the div before loading the new data, and then call
livequery on the click.

Any idea why livequery would do this, and what the solution would be?

[code]
        function loadForecast(lat, long){
        $('div#holdForecast').empty();

 var i=1;
     $.ajax({
      type: "GET",
      url: "widgets.php",
      data: "lat="+lat+"&long="+long,
      success: function(response){

        $('div#holdForecast').html('<ul class="List">'+response+'</
ul>');

         });


        $("li.reItem").livequery('click', function(event){

      alert(i);
      i++;
}
[/code]

when I run this code, the alert shows (1) if i've only run the
loadForecast function once. but if I get a second loadForecast
function, then the alert shows the number of times I've called the
funciton (2 or more).
So that is how I'm figuring that the 'click' function is being called
more than once per click.

Other alerts further down in the code also get called multiple times
as a result of the click.

Reply via email to