Split this array in jQuery
<p>I have an array of cities and ID's looking like: </p>

<pre><code>Brønderslev|810,Frederikshavn|813,Hjørring|860,Jammerbugt|849,Læsø|825,Mariagerfjord|846,Morsø|773,Rebild|840,Thisted|787,Vesthimmerland|820,Aalborg|851
</code></pre>

<p>I <strong>do not</strong> want this:</p>

<pre><code>&lt;option value="810"&gt;Frederikshavn&lt;/option&gt;
</code></pre>

<p>I <strong>do</strong> want this:</p>

<pre><code>&lt;option value="813"&gt;Frederikshavn&lt;/option&gt;
</code></pre>

<p>The commas separate the key/value <em>pairs</em> and the pipes separate the keys from the values.</p>

<p>I've come this far, however it doesnt seem to loop ? </p>

<pre><code>//Get cities by Region
</code></pre>

<p>function GetCitiesByRegion(args) {</p>

<pre><code>var params = '{"regionGuid":"' + args + '"}'

var request = {
    type: "POST",
    async: false,
    cache: false,
    url: "http://" + location.hostname + "/webservices/services.svc/GetCitiesByRegion",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    data: params,
    success: function (result) {
        //alert("Data Loaded: " + result.d);
        var resultData = result.d;
        alert(resultData);
        $jq.each(resultData.split('|'), function (city, value) {
           //alert(this);
           alert(city + ': ' + value);
        });
    },
    error: function (xhr, status, error) {
        alert('Fejl ved webservice: error: ' + error);
    }
};

$jq.ajax(request);
</code></pre>

<p>}             </p>
