Hi Lance, 'currentNode' is only accessible through server-side JavaScript.
Your first access of currentNode is client-side, and therefore is undefined. Best, Branden Speelmon, Lance Day wrote:
As a Sling newbie, could someone help me understand when currentNode gets initialized in an esp file? The following script shows that currentNode is undefined in the $(document).ready context, but is defined later(?) within the <h1> tags. Thanks, L <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <script type="text/javascript" src="/notifications/js/jquery/jquery-1.3.2.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ alert(typeof currentNode); // var props = currentNode.getProperties(); // alert(typeof props); // $.each(props, function(i, item){ // $("#console").append(i + ": " + item + "<br/>"); // }); }); </script> <body> <h1><%= currentNode.path %></h1> </body> </html> Lance Speelmon Scholarly Technologist
