title: Retrieve Items from a List View of a Sharepoint List using Javascript
body: <p>This is my code:\</p>
  
  <p>Here <code>pranav_list</code> is list name and <code>Main</code> is view of that list.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function retrieveListViewItems(){
      alert('start');
      var cc = SP.ClientContext.get_current();
      var alllist = cc.get_web().get_lists().getByTitle('pranav_list');
      var view = alllist.get_views().getByTitle('Main');
      var caml = new SP.CamlQuery();
      caml.set_viewXml('&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Leq&gt;' + 
                  '&lt;FieldRef Name=\'ID\'/&gt;&lt;Value Type=\'Number\'&gt;100&lt;/Value&gt;' + 
                  '&lt;/Leq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;RowLimit&gt;8&lt;/RowLimit&gt;&lt;/View&gt;'); 
  
      this.list = view.getItems(caml);
      cc.load(list);
     cc.executeQueryAsync(Function.createDelegate(this,this.QuerySucceeded5),Function.createDelegate(this,this.onQueryFailed));
      }
      function QuerySucceeded5(){
      var listiteminfo='';
  
      var listItemEnumerator = list.getEnumerator();
      while(listItemEnumerator.moveNext())
      {
        var listitem = listItemEnumerator.get_current();
  
       listiteminfo += '\nID:'+ listitem.get_id() +
                        '\nFirstName:' + listitem.get_item('Title') +
                        '\nLastName:' + listitem.get_item('LN') +
                        '\nAge:' + listitem.get_item('Age') +
                        '\n City:' + listitem.get_item('City');
  
      // alert(listiteminfo.toString());       
      }
      alert(listiteminfo.toString());
              }
      function onQueryFailed(){
      alert("Failed");
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>Help.!!</p>