title: Create dynamic list of dates in jQuery
body: <p>In javascript I need a plain list of dates like (for a jquery datepicker):</p>
  
  <pre><code>["16-5-2013", "24-5-2013", "25-5-2013", "26-5-2013"]
  </code></pre>
  
  <p>Because this list is dynamic I want to use this ajax call:</p>
  
  <pre><code>var disabledDays = $.ajax({
      type: 'GET',       
      url: "/disabled-days",
      });
  </code></pre>
  
  <p>In Django I wrote this test view which returns the data in json:</p>
  
  <pre><code>def disabled_days(request, soort):
      from django.http import HttpResponse
      import json
      soort = ["16-5-2013", "24-5-2013", "25-5-2013", "26-5-2013", "27-5-2013"]
      return HttpResponse(json.dumps(soort), mimetype="application/json")
  </code></pre>
  
  <p>Is json here the way to pass the data? I find the date list in the responsText, but I am unable to access this data. </p>
  
  <p>For example I tried to iter over the items like:</p>
  
  <pre><code>    for (i = 0; i &lt; disabledDays1.length; i++) {
      item = results[i];
      disabledDays.push(item);
  }
  </code></pre>
  
  <p>This results in an empty list.</p>
  
  <p>The responsetext is (encoding is json):</p>
  
  <pre><code>["16-5-2013", "24-5-2013", "25-5-2013", "26-5-2013"]
  </code></pre>
  
  <p>When I do a console.log() I see this info:</p>
  
  <pre><code>GET http://localhost:8080/disabled-days
  
  200 OK
          39ms    
  jquery-1.9.1.js (regel 8526)
  Object { readyState=1, getResponseHeader=function(), getAllResponseHeaders=function(), meer...}
  </code></pre>
  
  <p>Below is the solution Anh Tú gave (not working yet):</p>
  
  <pre><code>var disabledDays1 =     $.ajax({
      type: 'GET',       
      url: "/disabled-days",
      });
  
  var disabledDays = []
  
  for (i = 0; i &lt; disabledDays1.length; i++) {
      item = results[i];
      if(typeof(responsetext)==string){responsetext= JSON.parse(responsetext);} $.each(responsetext,function(i,item){disabledDays.push(item);});
  
  }
  console.log(disabledDays);
  </code></pre>