enable CardFortress in test database, #71513
[freeside.git] / httemplate / elements / rs_init_object.html
1 <%doc>
2
3 The rs_init_object javascript function defined by this include instantiates and
4 returns a new object for XMLHTTP communication: on Microsoft browsers, an
5 ActiveXObject ("Msxml2.XMLHTTP" or "Microsoft.XMLHTTP"), or on other browsers,
6 an XMLHttpRequest object.
7
8 Example:
9
10   <& /elements/rs_init_object.html &>
11
12 </%doc>
13 <%shared>
14 my $initialized = 0; #won't work if component is "preloaded"... so don't do that
15 </%shared>
16 % if ( ! $initialized++ ) {
17 <SCRIPT TYPE="text/javascript">
18
19   function rs_init_object() {
20     var A;
21     try {
22       A=new ActiveXObject("Msxml2.XMLHTTP");
23     } catch (e) {
24       try {
25         A=new ActiveXObject("Microsoft.XMLHTTP");
26       } catch (oc) {
27         A=null;
28       }
29     }
30     if(!A && typeof XMLHttpRequest != "undefined")
31       A = new XMLHttpRequest();
32     if (!A)
33       alert("Can't create XMLHttpRequest object");
34     return A;
35
36   }
37
38 </SCRIPT>
39 % }