function * getData(){
var callback = function * (data,err) {
if(err){
yield err;
}
if(data){
yield data;
}
};
var x = $.ajax({
url: 'http://localhost:9001/mydata',
success: callback
});
}
var d = getData();