title: Ajax load content into div from a json array
body: <p>My webpage is supposed to generating a series of questions in a random order. Each question is a seperate HTML page with a picture and multiple options.On page load, there should a default question and thereafter on clicking next a new page is loaded. I am currently:</p>
  
  <ol>
  <li>Creating a php array with the names of the html pages and shuffling it.</li>
  <li>Converting this array into a json array to be accessed in Javascript.</li>
  <li>Trying to ajax load the page.</li>
  </ol>
  
  <p>I am stuck at the third step; how do you send a json array element in an ajax call i.e.</p>
  
  <pre><code>$.ajax({
    url: name+".html",
    success: function(html){
      $("#container").empty().append(html);
    }
  });
  </code></pre>
  
  <p>where name is the name of the webpage stored in the json array and container is the div on my current php page.
  In case there is an easier way of doing the above task, I am open to that too.</p>
  
  <p>Thanks!</p>
  
  <p>EDIT
  Step 2:</p>
  
  <pre><code>         var xdata = &lt;?php echo json_encode($testArray); ?&gt;;
  </code></pre>
  
  <p>where $testArray is the php shuffled array of webpages.</p>