Bug Tracker

Modify

Ticket #7804 (closed bug: worksforme)

Opened 2 years ago

Last modified 2 years ago

function runs multiple times

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

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

comment:1 Changed 2 years ago by jitter

  • Status changed from new to closed
  • Resolution set to worksforme

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.