Retrieving XML Data - improve my approach
<p>I'm retrieving xml data for google markers, however I also wanted the marker count too, so I did it like this.</p>

<pre><code>&lt;markers&gt;
&lt;results count="6" /&gt;
&lt;marker id="1" lat="48.153938" lng="17.108459" icon_type="redicon" /&gt;
&lt;marker id="2" lat="48.152657" lng="17.127541" icon_type="redicon" /&gt;
&lt;marker id="3" lat="48.147572" lng="17.108433" icon_type="redicon" /&gt;
&lt;marker id="14" lat="48.153938" lng="17.108459" icon_type="redicon" /&gt;
&lt;marker id="15" lat="48.148170" lng="17.105650" icon_type="redicon" /&gt;
&lt;marker id="16" lat="48.148170" lng="17.105650" icon_type="redicon" /&gt;
&lt;/markers&gt;
</code></pre>

<p>Now, my markers retrieve post data like this, which works nicely:</p>

<pre><code>success: function (data, status, jqXHR) {

var markers = xml.documentElement.getElementsByTagName("marker");

for (var i = 0; i &lt; markers.length; i++) {
//lalalalala
</code></pre>

<p>Then I wanted to retrieve count and so I did this:</p>

<pre><code>success: function (data, status, jqXHR) {

$(data).find('markers').each(function(){
        var $entry = $(this);
        var pic = $entry.find('results').attr('count');
        $("#results").html(pic);
})

var xml = jqXHR.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");


for (var i = 0; i &lt; markers.length; i++) {
//lalala
</code></pre>

<p>However I'm sure there's a better way. Is there a way to combine what I did in the first instance with the markers to get the count as well? I just want to reduce the code in complexity.</p>

<p>Thanks!</p>
