Accueil/js/index.js

21 lines
799 B
JavaScript
Raw Normal View History

2010-09-14 23:38:29 +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"){
location.reload(); }else{ alert(data); }
2010-09-14 23:38:29 +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);
});
});