2 * This file is included in tophat_render.php
5 /* getting random error messages with this... -- jordan
6 wait until query code is fixed
7 jQuery(document).ready(function() {
8 // ajax default settings
12 if('parsererror'==e) {
13 alert('Sorry, we ran into a technical problem (parse error). Please try again...');
14 } else if('timeout'==e) {
15 alert('Request timed out. Please try again...');
17 else if ( "status" in x ) {
19 alert('You are offline! Please check your network.');
20 }else if (404 == x.status){
21 alert('Sorry, we ran into a technical problem (404). Please try again...');
22 }else if(500 == x.status){
23 alert('Sorry, we ran into a technical problem (500). Please try again...');
27 alert('Sorry, we ran into a technical problem (unknown error). Please try again...');
35 From: http://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-clone-a-javascript-object
36 I want to note that the .clone() method in jQuery only clones DOM elements. In order to clone JavaScript objects, you would do:
39 var newObject = jQuery.extend({}, oldObject);
42 var newObject = jQuery.extend(true, {}, oldObject);
44 More information can be found in the jQuery documentation <http://docs.jquery.com/Utilities/jQuery.extend>
46 function clone_object(obj) {
47 return jQuery.extend(true, {}, obj);
50 function executeFunctionByName(functionName, context /*, args */) {
51 var args = Array.prototype.slice.call(arguments).splice(2);
52 var namespaces = functionName.split(".");
53 var func = namespaces.pop();
54 for(var i = 0; i < namespaces.length; i++) {
55 context = context[namespaces[i]];
57 return context[func].apply(this, args);