When I click .dot element it should query database and show the result, and in second click it should hide the result. However it just show nothing in first click.
When I leave second if empty it successfully queries the database and show the result. But when I add this code $(".conte").hide(); to second if it shows nothing in click.
here is the code:
$(document).ready(function() {
var do1 = 0;
var do2 = 0;
var do3 = 0;
var do4 = 0;
$('.dot1').click(function() {
if (do1 == 0) {
do2 = 0; // for other function
do3 = 0; // for other function
do4 = 0; // for other function
do1 = 1;
$.ajax({
type: "POST",
url: "query1.php",
success: function(data) {
$(".conte").html(data);
}
});
}
if (do1 == 1) {
$(".conte").hide();
do1 = 0;
//hide me
}
// $(this).toggleClass('clicked');
});
});