Working against jQuery 1.3.2 I'm looking for best practices that implement the typical 'You are logged in as:' or 'Click here to login' pattern.
thx
Working against jQuery 1.3.2 I'm looking for best practices that implement the typical 'You are logged in as:' or 'Click here to login' pattern.
thx
How about something like this:
<script>
var logged = '{$usernameFromServer}';
$(document.ready(function() {
var span = null;
if(logged != '') {
span = $('<span>You are logged in as: ' + logged + '</span>');
} else {
span = $('<span>Click here to log in</span>');
}
$('#someDiv').append(span.html());
));
</script>
for a quick & dirty solution, to give you some idea, I coded that directly into SO so no guarantees :)
There really isn't a "pattern" here much less a mature one.
Patterns are a quick way to reference a typical implementation style or solution to a problem. They are generic in nature, and are not typically used in reference to user interface elements.
One the client side there is plenty of discussion around the design aspects of login boxes, but rarely implementation, because this is really dependent on how you have implemented login and session management.