Function not defined - jQuery/Javascript
<p>Another hapless noob...
Okay, so I've looked everywhere to try and find out how to make this jQuery/JavaScript function, I hope it's just a mistake in my syntax, but here's my code:</p>

<pre><code>&lt;script type="text/javascript"&gt;

$(function()
{
        function loadNext(choice) {
            $("#thequestion").load("question.php", { ans: choice, id: "&lt;?php echo $row['id']; ?&gt;", nextId: "&lt;?php echo $nextQuestionId; ?&gt;" } );

            $("#graph").load("graph.php", { id:"&lt;?php echo $row['id']; ?&gt;", nextId: "&lt;?php echo $nextQuestionId; ?&gt;" } );
            alert("loadNext activated");
        }

});
&lt;/script&gt;
</code></pre>

<p>I then call the <code>loadNext(choice)</code> function using an <code>onclick</code> event like so:
<code>onclick="loadNext(YorN);"</code>. </p>

<p>Following this I get a 'loadNext is not defined' error.</p>

<p>Amongst the answers that I would accept are: "Y U NO LEARN!" and "You are silly."</p>

<p><a href="http://stackoverflow.com/questions/3075449/function-is-not-defined">Here is a similar problem.</a></p>

<p>Thanks.</p>
