Passing a URL to a Javascript function
<p>I've spent a while going through numerous similar questions, but based on the answers given, I'm lead to believe I have this setup correctly - but it's not working, and I'm not sure why.</p>

<p>I'm a newbie with Javascript/jQuery, so it's very possible (or probable!) that I'm missing something completely obvious here.</p>

<p>I have a page with a large 'main' div, and I'm loading content into that using jQuery .load via the navigation.  That all works fine.  However, some of the target pages are data-heavy, so I'm trying to integrate something in between to indicate to the user that the page is loading.  Because there are numerous navigation elements, rather than having multiple functions (i.e one for each navigation element) I'm trying to do it in a single function, like so...</p>

<pre><code>&lt;script type="text/javascript"&gt;
function loadPage(pgurl) {
    $('#main').html('&lt;p align="center"&gt;Loading...&lt;/p&gt;');
    $('#main').load(' +pgurl+ ');
}
&lt;/script&gt;
</code></pre>

<p>The problem I have is the onclick within the navigation.  Prior to this, I had the .load within the onclick (i.e <em>onclick="$('#main').load('/pages/testpage/');"</em>) and that worked fine.  Now I'm firing the loadPage function via onclick, it's loading a black page (which firebug tells me is the site root).</p>

<p>Here's my onclick code;</p>

<pre><code>&lt;a onclick="loadPage('/pages/testpage/');return false;"&gt;Test&lt;/a&gt;
</code></pre>

<p>I get no errors returned.  I can only assume that the loadPage function is getting a zero value, rather than /pages/testpage/ - but I have no idea why!</p>

<p>Pointers much appreciated - much head scratching going on here!</p>
