javascript - Sending alert message if user not logged in -
What is the best way to send a warning message to a user if he needs to login, but at the same time Avoid calls? Send me the & lt; A href = "#" id = "vote" & gt; A code can be triggered, which will trigger an Ajax function based on the click. I was thinking that I would check on the server side if a user is logged in and changes it:
& lt; A href = "#" class = "not-logged-in" & gt;
If this is clicked it will inform them that they need to enter. The problem is that there may be some CSS style for my #vote. If instead I want it to be and lt; A href = "#" id = "vote" class = "not-logged-in" & gt;
, then it will trigger both AJAX calls and alerts, so I have to wrap the Ajax call around with a check, to see that the log-in class is not present, but it seems Is that the AJAX call for all my click functions, or do I call the original ID and set the style like #parentId {}? Or are there any better ways? I'm not sure what people usually do, so look at some opinions. Thanks!
How about:
HTML:
jQuery:
$ ('body.logged-in .vote'). Click (function () {$ (this) .append ($ .get ($ (this) .attr ('href')); return false;});
Comments
Post a Comment