Can someone please help why this is not working.
HTML Code:
<li><a href="#" onclick="adminDBDisplay(ownorg);" >OOrg</a></li>
<li><a href="#" onclick="adminDBDisplay(twoorg);" >Twoorg</a></li>
jQuery:
$(document).ready(function(){
function adminDBDisplay(db){
alert("Got into function" +db);
// Planning to use jQuery Ajax here
}
});
When I look using Firebug, I get following error:
"ReferenceError: adminDBDisplay is not defined"
Can someone please help me why this is not working. There something wrong on how I am approaching this. Please let me know if there are better ways. Thanks for your help.
When defining a function with
function name() {...}, if you are already inside a function, then it will only be defined in that function.Function definitions should not be wrapped in a
.ready(), since they don’t run until they are called. Remove the.ready()wrapper and you should be good to go.