title: How to add a dropdown list with page list in CQ5?
body: <p>I have the following code base to share with you guys to list the pages that fetch using the query builder via AJAX call. We have to pass the URL and the parameters to fetch the child pages from the URL that we provide.</p>
  
  <p>I have put some console.log to track the values of each states.
  replace the  with your project.</p>
  
  <pre><code>&lt;featurearticles
      jcr:primaryType="cq:Widget"
      fieldLabel="Article Pages"
      itemId="selectauthorId"
      name="./authorselect"
      type="select"
      xtype="selection"&gt;
      &lt;options jcr:primaryType="cq:WidgetCollection"/&gt;
      &lt;listeners
          jcr:primaryType="nt:unstructured"
          loadcontent="function(box,value) { 
          CQ.Ext.Ajax.request({ 
              url: '/bin/querybuilder.json', 
              success: function(response, opts) { 
                  console.log('Response from the ajax'); 
                  var resTexts = $.parseJSON(response.responseText); 
                  var selectopts = []; 
                  console.log(resTexts); 
                  $.each(resTexts.hits, function(key, page) { 
                      console.log(page); 
                      selectopts.push({value: page['path'], text:page['name']}); 
                  }); 
                  console.log(selectopts); 
                  box.setOptions(selectopts); 
              },  
              params: {
              'type' :'cq:Page', 
              'group.1_path' : '/content/&lt;PROJECT_NAME&gt;/Feature_Articles' 
              } 
          }); 
         }"
         selectionchanged="function(box,value) { 
          var panel = this.findParentByType('panel');
          var articleTitle = panel.getComponent('articleTitleId');
  
          CQ.Ext.Ajax.request({ 
              url: value + '/_jcr_content/par/featurearticleintro.json',
              success: function(response, opts) {
                  console.log('success now');
                  var resTexts = $.parseJSON(response.responseText); 
                  console.log(resTexts);
              },
              failure: function(response, opts) {                    
                  console.log('server-side failure with status code ' + response.status);
              }
          });            
      }"/&gt;
  &lt;/featurearticles&gt;
  </code></pre>
  
  <p>If you have any better idea than this, I would like to know about that.</p>
  
  <p>Cheers,</p>