Gündoğdu Yakıcı Gündoğdu Yakıcı - 4 months ago 8
HTML Question

jQuery After the page is refreshed remove class

The user after logging in remove hidden class.Mean After the page is refreshed.How can I do ?

My jQuery code:



$.ajax({
type :"POST",
url : link,
dataType: "json",
data : $("#girisform").serialize(),
success: function(){
$("#hosgeldiniz").removeClass("hidden");
$(".close").trigger("click");
$("#giris").trigger("click");
setTimeout(function() {
window.location.href = "http://tantunisiparis:8080/"
}, 1300);
$("#userinfo").removeClass("hidden");
},
error: function()
{
$("p#hata2").removeClass("hidden");
$("p#hata2").html("HATA! Lütfen Tekrar Deneyiniz.");
}
});

<div class="top-nav">
<nav style="float:right">
<ul>
<li id="girisyap"><a href="#" id="login-btn">GİRİŞ YAP</a></li>
<li id="kayitol"><a href="#" class="register-btn">KAYIT OL</a></li>
<li id="userinfo" class="hidden"><a href="javascript:;"><?php echo $this->session->userdata('kullaniciadi');?></a></li>
</ul>
</nav>
</div>





Thanks for all the answers.

Answer

I think you change php code. Reflesh page check user logged.

<div class="top-nav">
    <nav style="float:right">
        <ul> 
            <?php if ( !is_logged_in() ){ ?>
                <li id="girisyap"><a href="#" id="login-btn">GİRİŞ YAP</a></li>
                <li id="kayitol"><a href="#" class="register-btn">KAYIT OL</a></li>
            <?php } else { ?>
                <li id="userinfo" class="hidden"><a href="javascript:;"><?php echo $this->session->userdata('kullaniciadi');?></a></li>
            <?php } ?>
        </ul>          
    </nav>
</div>

Look at : How to check user if logged in My_Controller at CodeIgniter