var Doc = Backbone.Model.extend({ defaults: { api_token: null, dockey: null, dbkey: null }, initialize: function(){ var session = new Session(); this.set('api_token', session.getApiKey()) }, methodUrl: { 'create': '/api/admin/get_license_info' }, sync: function(method, model, options) { if (model.methodUrl && model.methodUrl[method.toLowerCase()]) { options = options || {}; options.url = model.methodUrl[method.toLowerCase()]; // if(method == 'read'){ // options.url += "?api_token=" + this.get('api_token') // } } Backbone.sync(method, model, options); }, get_doc: function(dbkey,d_type){ self = this; var session = new Session(); var dt = 'hash'; if(dbkey.search(/token/i) > 0 || dbkey.search(/size/i) > 0 || d_type == 'string'){ dt = 'string'; } this.set('dbkey',dbkey); $.ajax({ type: 'POST', url: '/api/source/get_db_doc', data: {api_token : session.getApiKey, doc : dbkey, data_type : dt}, success: function(resp){ var data = "" r = self.formatJson(resp) if(resp != ''){ data += "
" + r+ "