PageSourceSearch

https://career-meet.com/wp-content/plugins/booking-package/js/XMLHttp.js?ver=1.6.47&date=1791425199

js career-meet.com collected 2026-10-08 02:06:53 UTC 5,620 bytes, 268 lines download raw bytes

1
2	function Booking_App_XMLHttp(url, data, webApp, callback, responseCallback) {
3		
4		if(webApp == true){
5			
6			data.app = 'json';
7			
8		}
9		
10		this._error = false;
11		this._count = 0;
12		
13		var object = this;
14		object.request(url, data, callback, responseCallback);
15		
16	}
17	
18	Booking_App_XMLHttp.prototype.setError = function(error) {
19		
20		this._error = error;
21		
22	}
23	
24	Booking_App_XMLHttp.prototype.getError = function() {
25		
26		return this._error;
27		
28	}
29	
30	Booking_App_XMLHttp.prototype.addCount = function() {
31		
32		this._count++;
33		
34	}
35	
36	Booking_App_XMLHttp.prototype.getCount = function() {
37		
38		return this._count;
39		
40	}
41	
42	Booking_App_XMLHttp.prototype.setStatus = function(status){
43		
44		this._status = status;
45		
46	}
47	
48	Booking_App_XMLHttp.prototype.getStatus = function(){
49		
50		return this._status;
51		
52	}
53	
54	Booking_App_XMLHttp.prototype.requestCreate = function(){
55		
56		try{
57			
58			return new XMLHttpRequest();
59			
60		}catch(e){}
61		
62		return null;
63			
64	}
65	
66	Booking_App_XMLHttp.prototype.request = function(url, data, callback, responseCallback){
67		
68		var object = this;
69		try {
70			
71			var xhr = new XMLHttpRequest();
72			xhr.onreadystatechange = function(){
73				
74				switch (xhr.readyState) {
75				
76					case 4:
77					if (xhr.status == 0) {
78					
79						//callback({status: "ERROR"});
80					
81					} else {
82					
83						if ((200 <= xhr.status && xhr.status < 300) || (xhr.status == 304)) {
84							
85							
86							
87						} else {
88							
89							//callback({status: "ERROR"});
90							
91						}
92					
93					}
94					
95					break;
96					
97				}
98				
99			};
100			
101			xhr.onload = function(e){
102				
103				object.setStatus(xhr.status);
104				if (responseCallback != null && typeof responseCallback == "function") {
105					
106					responseCallback(xhr.responseText);
107					
108				}
109				
110				if (xhr.status == 401) {
111					
112					window.alert("Failed to load resource: the server responded with a status of 401 (Authorization Required). In order to use Booking Package, you need to cancel Basic Authentication. Basic authentication URL: " + url);
113					
114				}
115				
116				//var bool = object.isJSON(xhr.responseText);
117				var bool = true;
118				if (xhr.status == 200 || xhr.status == 304) {
119					
120					if (object.isJSON(xhr.responseText) === true) {
121						
122						var responseJson = JSON.parse(xhr.responseText);
123						callback(responseJson);
124						
125					} else {
126						
127						object.errorJSONFormat(xhr.responseText, xhr.status, 'errorJsonFormat');
128						
129					}
130					
131				} else {
132					
133					console.log(xhr.responseText);
134					if (object.isJSON(xhr.responseText) === true) {
135						
136						var responseJson = JSON.parse(xhr.responseText);
137						callback(responseJson);
138						
139					} else {
140						
141						object.errorJSONFormat(xhr.responseText, xhr.status, 'errorInServer');
142						
143					}
144					//window.alert("Response Error. HTTP Status: " + xhr.status);
145					//callback({status: 0, status_code: xhr.status});
146					
147				}
148				
149				
150			}
151			
152			xhr.onerror = function(e){
153				
154				console.log(e);
155				object.setError(true);
156				var count = object.getCount();
157				if (count < 10) {
158					
159					var timer = setInterval(function() {
160                        
161                        object.addCount();
162						object.request(url, data, callback, responseCallback);
163                        clearInterval(timer);
164                        
165                    }, 500);
166					
167				} else {
168					
169					callback({status: "ERROR"});
170					
171				}
172				
173			}
174			
175			xhr.open("POST", url);
176			xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
177			xhr.send(this.encodeHTMLForm(data));
178			
179		} catch(e) {
180			
181		} finally {
182			
183		}
184		
185		return null;
186			
187	}
188		
189	Booking_App_XMLHttp.prototype.encodeHTMLForm = function(data){
190		
191    	var params = [];
192		
193		for( var name in data ){
194			
195        	var value = data[ name ];
196			var param = encodeURIComponent( name ) + '=' + encodeURIComponent( value );
197			
198			params.push( param );
199    	}
200		
201		return params.join( '&' ).replace( /%20/g, '+' );
202		
203	}
204	
205	Booking_App_XMLHttp.prototype.isJSON = function(jsonString){
206		
207		try {
208			JSON.parse(jsonString);
209			return true;
210		} catch (error) {
211			return false;
212		}
213		
214		/**
215		arg = (typeof arg === "function") ? arg() : arg;
216	    if(typeof arg  !== "string") {
217	        return false;
218	    }
219	    
220	    try{
221	    	arg = (!JSON) ? eval("(" + arg + ")") : JSON.parse(arg);
222			return true;
223	    }catch(e){
224			return false;
225	    }
226		**/
227		
228	}
229	
230	
231	Booking_App_XMLHttp.prototype.errorJSONFormat = function(jsonString, status, errorType){
232		
233		var object = this;
234		var statusMessage = 'JSON format error.';
235		if (errorType == 'errorInServer') {
236			
237			statusMessage = 'During the communication (AJAX) between this browser and the server, the server returned an HTTP status code ' + status + ". To resolve this issue, please contact the server administrator. \n\n";
238			
239		}
240		console.log(jsonString);
241		var booking_package_json_format_error_panel = document.getElementById('booking_package_json_format_error_panel');
242		if (booking_package_json_format_error_panel != null) {
243			
244			booking_package_json_format_error_panel.classList.remove('hidden_panel');
245			var errorPanel = booking_package_json_format_error_panel.getElementsByTagName('p')[0];
246			if (errorPanel !=  null) {
247				
248				errorPanel.textContent = statusMessage;
249				
250			}
251			
252			errorPanel = booking_package_json_format_error_panel.getElementsByTagName('p')[1];
253			if (errorPanel !=  null) {
254				
255				errorPanel.textContent = jsonString;
256				
257			}
258			
259			document.getElementById('bookingBlockPanel').classList.add('hidden_panel');
260			
261		} else {
262			
263			window.alert(statusMessage + ': ' + jsonString);
264			
265		}
266		
267	};
268	

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.