function CommonApi() { this.initialize.apply(this, arguments); } CommonApi.prototype = { initialize : function() { this._clear(); this.dateObj = new Date(); }, /* APIキャッシュをクリアする */ _clear : function() { this.api_cache = {}; }, getCache : function(url) { return this.api_cache[url] || null; }, setCache : function(url, data) { this.api_cache[url] = data; }, /* JSON取得 */ get : function(url, params, callback, noerror, cacheFlg, addressFlg) { var results; if (cacheFlg && (results = this.getCache(url))) { callback(results); return; } params['HIDDEN_SESSION'] = ''; params['_'] = new Date().getTime(); var self = this; $.ajax({ cache : false, url : Settings.webapi_path + url, dataType : 'json', type : 'POST', data : params, timeout : Settings.timeout * 1000, success : function(response) { if (addressFlg) { callback(response); return; } if (response.error) { if (noerror) return; commonError.execute(response.errorInfo, 'A'); indicator.off(); return; } if (cacheFlg) self.setCache(url, response); callback(response); }, error : function() { if (noerror) return; var errorInfo = [{ errorCd: '', errorMsg: Messages.get('SPSYSMSG002'), properties: [] }]; commonError.execute(errorInfo, 'A'); indicator.off(); } }); } };