ajax two callbacks in the api