jquery - Trigger a link remotely -


i have sidemenu , form logging out (default generated mvc)
how can make when user clicks in on <li> element trigger log out link?

and wondering if inline javascript or trick?

            <li id="log-out-li">                 @using (html.beginform("logoff", "account", formmethod.post, new { id = "logoutform" }))                 {                     @html.antiforgerytoken()                     <a href="javascript:document.getelementbyid('logoutform').submit()"><i class="fa fa-sign-out fa-fw"></i> log out</a>                 }             </li> 

i'm not sure why you'd want make <li> clickable, here go...

document.getelementbyid('log-out-li').addeventlistener('click', function() {     document.getelementbyid('logoutform').submit(); }); 

i'd advise making logoff page simple , hyperlink regular <a href="..." tag rather li though


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -