function cbfunc(o){
$('body').append('
Select your project
');
$('#results').append('');
for(var i in o)
{
$('#uncompletedList').append('- '+o[i].name+'
');
}
}
$(document).ready(function(){
var token = "=$token?>";
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://todoist.com/API/getProjects?token='+token+'&format=json&callback=cbfunc';
document.getElementsByTagName('head')[0].appendChild(script);
$('.selectableProject').live('click', function(){
var name = $(this).text();
var id = $(this).attr('id');
$.post('../ajax/saveTodoist.php', {name: name, id: id}, function(msg){
$('body').append('Etape suivante');
if(msg=="ok"){
location.reload();
}else{
alert(msg);
}
});
});
});