Modify ↓
Ticket #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: | ||
| 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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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.