File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ function HttpRequest ( url , callback , async ) {
2+ this . request = new XMLHttpRequest ( ) ;
3+ this . request . open ( "GET" , url , async ) ;
4+ var tempRequest = this . request ;
5+ function reqReadyStateChange ( ) {
6+ if ( tempRequest . readyState == 4 ) {
7+ if ( tempRequest . status == 200 ) {
8+ callback ( tempRequest . responseText ) ;
9+ } else {
10+ alert ( "An error occurred trying to contact the server." ) ;
11+ }
12+ }
13+ }
14+ if ( async ) {
15+ this . request . onreadystatechange = reqReadyStateChange ;
16+ } else {
17+ this . request . send ( null ) ;
18+ if ( tempRequest . status == 200 ) {
19+ callback ( tempRequest . responseText ) ;
20+ } else {
21+ alert ( "An error occurred trying to contact the server." ) ;
22+ }
23+ }
24+ }
25+ HttpRequest . prototype . send = function ( ) {
26+ this . request . send ( null ) ;
27+ } ;
You can’t perform that action at this time.
0 commit comments