/[Frey]/trunk/static/lib/Joose/SimpleRequest.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/static/lib/Joose/SimpleRequest.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 46 - (hide annotations)
Wed Jul 2 10:28:49 2008 UTC (16 years ago) by dpavlin
File MIME type: application/javascript
File size: 1087 byte(s)
added upstream Joose r4755

http://code2.0beta.co.uk/moose/svn/Joose/trunk/lib
1 dpavlin 46 /**
2     * Class to perform simple synchronous AJAX Requests used for component loading.
3     * @name Joose.SimpleRequest
4     * @class
5     */
6     Class("Joose.SimpleRequest", {
7    
8     has: {_req: {}},
9     methods: {
10     initialize: function () {
11     if (window.XMLHttpRequest) {
12     this._req = new XMLHttpRequest();
13     } else {
14     this._req = new ActiveXObject("Microsoft.XMLHTTP");
15     }
16     },
17     /**
18     * Fetches text from an URL
19     * @name getText
20     * @param {string} url The URL
21     * @function
22     * @memberof Joose.SimpleRequest
23     */
24     getText: function (url) {
25     this._req.open("GET", url, false);
26     try {
27     this._req.send(null);
28     if (this._req.status == 200 || this._req.status == 0)
29     return this._req.responseText;
30     } catch (e) {
31     throw("File not found: " + url);
32     return null;
33     };
34    
35     throw("File not found: " + url);
36     return null;
37     }
38     }
39     })

  ViewVC Help
Powered by ViewVC 1.1.26