That works but not recommended. If you're going to define something in the global namespace you should use the first method.
回答3:
Short version: you can't, it's out of scope. Define your method like this so it's available:
function lol(){ alert('lol');} $(function(){ lol();});
回答4:
You don't need and of that - If a function is defined outside of Document.Ready - but you want to call in it Document.Ready - this is how you do it - these answer led me in the wrong direction, don't type function again, just the name of the function.
$(document).ready(function(){ fnGetContent();});
Where fnGetContent is here:
function fnGetContent(keyword){varNewKeyword= keyword.tag;var type = keyword.type; $.ajax({.......
回答5:
What about the case where Prototype is installed with jQuery and we have noconflicts set for jQuery?