21 lines
670 B
JavaScript
21 lines
670 B
JavaScript
|
function cbfunc(o){
|
||
|
var token = o.api_token;
|
||
|
if(token == undefined){
|
||
|
$('#error').html('Identification erronnée');
|
||
|
}else{
|
||
|
$.get('saveTodoist.php', {token: token}, function(){
|
||
|
location.reload(true);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$(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);
|
||
|
});
|
||
|
});
|