title: javascript xmlhttprequest to variable?
body: <pre><code>        require(["dojo/ready", "dojo/_base/declare", "dojo/on", "dojo/date/locale", "dojo/parser", "dojo/date", "dojo/_base/lang",
                  "dojo/dom", "dojo/dom-construct", "dojo/dom-class", "dojo/_base/window",
                  "dijit/registry", "dojo/query", "dojox/calendar/MonthColumnView", "dojox/calendar/Touch",
                  "dojox/calendar/MobileVerticalRenderer", "dojox/calendar/time", "dojo/store/Memory", "dojo/store/Observable",
                   "dojo/_base/fx"],
              function(ready, declare, on, locale, parser, date, lang, dom, domConstruct, domClass, win, registry, query,
                  MonthColumnView, CalendarTouch, VerticalRenderer, time, Memory, Observable, fx){
                  ready(function(){                       
                      resultat="";
                      var xhr = new XMLHttpRequest ();
                      xhr.onreadystatechange = function(){if(xhr.readyState == 4 &amp;&amp; xhr.status == 200){resultat = xhr.responseText;alert("resultat1="+resultat);}}
                      xhr.open("GET","reservations.php",true);
                      xhr.send();
                      alert("resultat2 ="+resultat);
                      var someData= resultat;
                      alert("someData = "+someData);
  
                      // Calendar creation &amp; configuration
  
                      monthView = declare([MonthColumnView, CalendarTouch])({
                          store: new Observable(new Memory({data: someData})),
                          verticalRenderer: VerticalRenderer,
                          columnCount: 3                           
                      }, "calendarNode");
  
                      // Events management
  
                      fx.fadeOut({
                          node:"loadingPanel",
                          onEnd: function(node){
                              node.parentNode.removeChild(node)
                          }}).play(500);
                  });
          });
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>resultat1=[{summary:"Box2",startTime:new Date(2015,08,20),endTime:new Date(2015,08,25)},{summary:"Box2",startTime:new Date(2015,08,05),endTime:new Date(2015,08,20)},{summary:"Box10",startTime:new Date(2015,08,12),endTime:new Date(2015,09,17)},{summary:"Box8",startTime:new Date(2015,08,28),endTime:new Date(2015,09,02)}];
  resultat2 = nothing
  </code></pre>
  
  <p><code>someData</code> give <code>resultat1</code>, but nothing more after in function.
  any idea ?</p>