Created
December 7, 2010 20:39
-
-
Save pjhoberman/732366 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.extend( { | |
updateBlock: function(url, options, callback){ | |
$.updateBlock.defaults = { | |
formatDate: false | |
}; // defaults | |
$.updateBlock.options = $.extend({}, $.updateBlock.defaults, options || {}); | |
console.log( $.updateBlock.options ); | |
$.get(url, function(data){ | |
var r = data.output; // r for record | |
for (var key in r) { | |
if (r.hasOwnProperty(key)) { | |
//console.log( key + ' - ' + typeof r[key] + ' - ' + r[key]); | |
if( typeof r[key] == 'object' ) // units and values | |
$( '#' + key ).text( quantity(r[key])); | |
else | |
{ | |
if( r[key] == '' && typeof r[key] == 'string' ) // for blank strings | |
r[key] = '--'; | |
$( '#' + key ).text( r[key] ); | |
} // else | |
} // if | |
} // for | |
if( typeof callback == 'function' ) | |
callback.call(this); | |
}); // get | |
} | |
}); // extend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And semicolons!;