Project

General

Profile

« Previous | Next » 

Revision 5705

catch error when jQuery is not included in the page, but do nothing

View differences:

lib/style/common/branding.js
289 289
* This uses jQuery to load access log information
290 290
**/
291 291
function loadStats(divId, docId, url, qformat) {
292
	$("#" + divId).load(
293
		url, 
294
		{
295
			'action': "getlog",
296
			'docid': docId,
297
			'qformat': qformat
298
		},
299
		// call back function when loading finishes
300
		function(response, status, xhr) {
301
			//alert("callback for: " + divId + " selected node: " + selectedNodeId);
302
			// error
303
			if (status == "error") {
304
				var msg = "Sorry but there was an error: ";
305
				$("#error").html(msg + xhr.status + " " + xhr.statusText);
306
			}
307
		});
308
}
292
	try {
293
		$("#" + divId).load(
294
			url, 
295
			{
296
				'action': "getlog",
297
				'docid': docId,
298
				'qformat': qformat
299
			},
300
			// call back function when loading finishes
301
			function(response, status, xhr) {
302
				//alert("callback for: " + divId + " selected node: " + selectedNodeId);
303
				// error
304
				if (status == "error") {
305
					var msg = "Sorry but there was an error: ";
306
					$("#error").html(msg + xhr.status + " " + xhr.statusText);
307
				}
308
			});
309
		} catch (e) {
310
			// do nothing - jQuery was probably not included
311
		}
312
}

Also available in: Unified diff