Method for Ajax Request in Api.js