inject promise and ajax request function instead of hardcoding them, close #2