1function initReq(reqType,url,bool){ 2 3 try{ 4 5 /* Specify the function that will handle the 6 7 HTTP response */ 8 9 request.open(reqType,url,bool); 10 request.onreadystatechange=handleResponse; 11 12 if(reqType.toLowerCase() == "post") { 13 request.setRequestHeader("Content-Type", 14 "application/x-www-form-urlencoded; charset=UTF-8"); 15 request.send(arguments[3]); 16 } else { 17 request.send(null); 18 } 19 } catch (errv) { 20 21 alert( 22 23 "The application cannot contact the server "+ 24 25 "at the moment. "+ 26 27 "Please try again in a few seconds."+errv.message ); 28 29 } 30 31} 32 33/* Wrapper function for constructing a request object. 34 35 Parameters: 36 37 reqType: The HTTP request type, such as GET or POST. 38 39 url: The URL of the server program. 40 41 asynch: Whether to send the request asynchronously or not. */ 42 43function httpRequest(reqType,url,asynch){ 44 45 //Mozilla-based browsers 46 47 if(window.XMLHttpRequest){ 48 49 request = new XMLHttpRequest( ); 50 51 } else if (window.ActiveXObject){ 52 53 request=new ActiveXObject("Msxml2.XMLHTTP"); 54 55 if (! request){ 56 57 request=new ActiveXObject("Microsoft.XMLHTTP"); 58 59 } 60 61 } 62 63 //the request could still be null if neither ActiveXObject 64 65 //initialization succeeded 66 67 if(request){ 68 69 70 71 if(reqType.toLowerCase() != "post") { 72 initReq(reqType,url,asynch); 73 } else { 74 //the POSTed data 75 var args = arguments[3]; 76 if(args != null && args.length > 0){ 77 initReq(reqType,url,asynch,args); 78 } 79 } 80 } else { 81 82 alert("Your browser does not permit the use of all "+ 83 84 "of this application's features!");} 85 86}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.