modified methods for getData and postData to take extra parameters as method reference which needs to be called depending upon the results returned from these ajax calls.