I am new in jquery. when i choose league 1 or 2 once, html() works but twice, not working. is there a solution or alternative about this error. I dont know where the problem is.
$("#league").on('change', function() {
var leagueid = $(this).val();
//alert(leagueid);
if (lig > 0) {
$.ajax({
url: 'include/ajax.php?query=fixture',
type: 'POST',
data: {
lid: leagueid,
sid: <?php echo $curs_id; ?>
},
success: function(result) {
//alert(result);
if (result == 0) {
$("#alert").html('');
//$("#dates").slideDown();
FetchTeams(leagueid);
} else {
$("#dates").slideUp();
$("#alert").delay(600).queue(function() {
$(this).html("Fixture already exists!");
}).fadeIn(100);
$("#teams").html('');
}
}
});
} else {
$("#dates").slideUp();
$("#alert").html('');
}
});