Bug Tracker

Opened 8 years ago

Closed 8 years ago

#7804 closed bug (worksforme)

function runs multiple times

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

The following works correctly the first time. But if clicked again before a page refresh or page reload, it runs 2 or sometimes more times. Even after adding the $(this).unbind(); line.

$(document).ready(function() {
$("a#searchowner").click(function() {
var searchval=$("#p1").val(); 
  alert(searchval);
  $.post("findowner.php", {p1 : searchval}, function(data){
   if (data.length>0){ 
     //$("#ownerIDdiv2").fadeIn(1000).html(data);
	 $("#ownerIDdiv2").html(data); 
   } 
  }) 
   
$(this).unbind(); 
});
});   ///////////////end//////////////////////////

Change History (1)

comment:1 Changed 8 years ago by jitter

Resolution: worksforme
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

I made a live test case and couldn't reproduce what you described. Please report back if you can provide a test case which reproduces your problem (ideally on http://jsfiddle.net) so that we can investigate this issue further.

Note: See TracTickets for help on using tickets.