title: FullCalendar and Multiple Dynamic Event Sources
body: <p>I have FullCalendar (1.6.4) working with a single JSON feed (a single user's calendar). Now, I want to enhance the functionality so the calendar will display multiple user calendars (the admin and their child account calendars). Until the calendar is called, I won't know how many user calendars will be called. So, I have a Ajax function call a PHP script that returns a JSON feed of all user ID's for the admin account. </p>
  
  <pre><code>$(document).ready(getUsers);
  
  function getUsers() {
      var data = $.ajax( {
          url: '/s/calendar_userdata.php',
          method: 'GET',
          dataType: 'json',
          success: function(userData) {
              var user_count = userData.length;
              var uid_array = [];
  
              // Create the sources
              for (var i = 0; i &lt; user_count; i++)
              {
                  var uid = userData[i].uid;
                  if(!uid_array[i]) uid_array[i] = [];
                  uid_array[i] = uid;
              }
          }
      });
      loadCal();
  }
  </code></pre>
  
  <p>The Ajax call works. I get an array (uid_array) such as [7,47] back, as expected. I would like to use this array within my loadCal function as illustrated below, but I can't get it to persist after the getUsers function has concluded. </p>
  
  <pre><code>function loadCal() {
      $('#calendar').fullCalendar({
          eventSources: [
          {
              url: '/s/events.php',
              type: 'GET',
              data:
              {
                  uid: uid_array
              }
          }
          ],
          editable: true,
          .........
  </code></pre>
  
  <p>I've tried:
  1) Creating a global variable by initially defining uid_array outside of getUsers without the "var". 
  2) Setting "window.uid_array = uid_array;" within the getUsers function.
  3) Adding "return uid_array;" at the end of the getUsers function.
  4) Adding a closure at the end of the getUsers function. But, I don't grasp them well enough to believe I did it correctly.</p>
  
  <p>I have 2 questions:
  1) How do I make the array (uid_array) available outside of getUsers?
  2) In what format does the array need to be so that fullCalendar will recognize and use it?</p>
  
  <p>I've been stuck on this for a while. Thanks much.</p>