I tried to implement persona in my site but i don't get it to work.
<body>
<a href="" class="login">login</a>
<script src="https://login.persona.org/include.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
$(function() {
$('#login').click(function(e){ navigator.id.request(); });
$('#logout').click(function(e){ navigator.id.logout(); });
navigator.id.watch({
loggedInUser: null,
onlogin: function(assertion) {
$.post(
'/auth.php',
{assertion:assertion},
function(msg) { console.log('login success!') }
);
},
onlogout: function() {
$.post(
'/auth.php',
{logout:1},
function(msg) { console.log('logout success!') }
);
}
});
});
</script>
</body>
Here is a fiddle: http://jsfiddle.net/cMeUp/ but i don't even get a popup.
Do you guys know anything thats wrong with it?
Greetings
in your code your using
login
as aclass
not as anid
your code:
try:
as you are using
$('#login')
as a selector.here's a working JSFiddle