added basePath and action settings, added invalidData handling (in case of server not responding JSON)