2010-09-27 16:37:14 +02:00
|
|
|
function cbfunc(o){
var token = o.api_token;
if(token == undefined){
$('#error').html('Identification erronnée');
}else{
$.post('../ajax/saveTodoist.php', {token: token}, function(data){
$('body').append('<a href="getProjectsList.php">Etape suivante</a>');
if(data=="ok"){
|
2010-09-15 11:54:20 +02:00
|
|
|
location.reload();
}else{
alert(data);
}
|
2010-09-27 16:37:14 +02:00
|
|
|
});
}
}
|
|
|
|
$(document).ready(function(){
$('#loginBtn').click(function(){
var email = $('#email').val();
var password = $('#password').val();
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://todoist.com/API/login?email='+email+'&password='+password+'&format=json&callback=cbfunc';
document.getElementsByTagName('head')[0].appendChild(script);
});
$('#email').keydown(function(e){
if(e.which == 13){
$('#loginBtn').trigger('click');
}
});
$('#password').keydown(function(e){
if(e.which == 13){
$('#loginBtn').trigger('click');
}
});
});
|