Counting classes on another page and displaying them
<p>To save me a lot of work editing a number in when adding a document to a site I decided to use javascript to count the number of elements with a class <code>doc</code> .</p>

<p>I am two main problems:</p>

<ul>
<li><p>There is trouble displaying the variable. I initially thought this was because I hadn't added <code>function</code>, however when I tried adding this the variable was still not displayed.</p></li>
<li><p>The elements with the class I want to count are on another page and I have no idea how to link to it. For this I have tried <code>var x = $('URL: /*pageURL*/ .doc').length;</code> which hasn't worked. </p></li>
</ul>

<p>Essentially I want the total elements with said class name and this to be displayed in a span element. </p>

<p>Currently I have something similar to what's displayed below:</p>

<pre><code> &lt;script&gt;
 var Items = $('.doc').length;
 document.getElementById("display").innerHTML=Items;
 &lt;/script&gt;
 &lt;span id="display"&gt;&lt;/span&gt;
</code></pre>

<p>Found an example of something similar <a href="http://en.wikipedia.org/wiki/Special%3aStatistics" rel="nofollow">here</a> where the total numbers of articles are displayed.</p>

<p><strong>Edit:</strong> </p>

<p>@ian
This code will be added to the homepage, domain.net/home.html. I want to link to the page containing this documents, domain.net/documents.html. I've seen this done somewhere before and if I remember correctly they used <code>url:domainname.com/count</code> somewhere in their code. Hope this helps.</p>
