Sha256: 72321d0b85472638157e2c9a0c7932837a0895d0307148799e843e9fbc510f00
Contents?: true
Size: 773 Bytes
Versions: 7
Compression:
Stored size: 773 Bytes
Contents
/* --- name: Request.JSON description: Extends the basic Request Class with additional methods for sending and receiving JSON data. license: MIT-style license. requires: [Request, JSON] provides: Request.JSON ... */ Request.JSON = new Class({ Extends: Request, options: { /*onError: function(text, error){},*/ secure: true }, initialize: function(options){ this.parent(options); Object.append(this.headers, { 'Accept': 'application/json', 'X-Request': 'JSON' }); }, success: function(text){ var json; try { json = this.response.json = JSON.decode(text, this.options.secure); } catch (error){ this.fireEvent('error', [text, error]); return; } if (json == null) this.onFailure(); else this.onSuccess(json, text); } });
Version data entries
7 entries across 7 versions & 1 rubygems