To trigger a function defined in your document.ready function, you need to define a variable before the $(document).ready() that references the new function.
For example, function test() defined inside $(document).ready() is not accessible with setInterval('test()', 500), or something like onclick="javascript:test()"
$(document).ready( function() {
function test() { alert('test'); }
setInterval("test()", 500);
});
Will fail with ReferenceError
The following will work though:
var test;
$(document).ready( function() {
test = function() { alert('test'); };
setInterval("test()", 500);
});
Will work.