title: How to loop through additional pages using google places and javascript API?
body: <p>I am building a single page application and am using the frontend javascript API to access google maps and places. I am successfully able to generate a google map and get the establishments details through this api, however, the javascript API does not return a "next_page_token" that allows me to search for additional results after the first 20. </p>
  
  <p>How do you use the javascript API to get the next_page_token to loop through multiple pages of results? I am desperate since I can't find any information about this anywhere.</p>
  
  <p><strong>Edit - Including some additional info.</strong></p>
  
  <p>Doing a nearbySearch using the documentation <a href="https://developers.google.com/maps/documentation/javascript/examples/place-search" rel="nofollow noreferrer">provided by Google here</a> simply returns a set of 20 results with no additional properties in the response.</p>
  
  <p>Here is the request I am making using Javascript API. I have the script included on my index.html file.</p>
  
  <pre><code>let map = new google.maps.Map(this.$refs.map, {
      center: this.location,
      zoom: 12,
      disableDefaultUI: true,
      scrollwheel: false
  })
  
  let request = {
      location: this.location,
    radius: 10000,
    type: ['restaurants'] 
  }
  
  let service = new google.maps.places.PlacesService(map)
  service.nearbySearch(request, (results, status) =&gt; {
      console.log("Results", results)
      console.log("Status", status)
  })
  </code></pre>
  
  <p>Here is what google is sending back. Taking from console in devtools.</p>
  
  <pre><code>Results (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
  </code></pre>
  
  <p>Results from nearbySearch request third argument.</p>
  
  <pre><code>a4 {f: ƒ, b: ƒ, l: "CqQCIAEAAPcNpixD40jA39VnP-WMOZT21nGCcfpK_smpYhG66W…UWk72OjPB1A7Mdudz6UhoUD_vqC-QSk7CKnoveUXK0IHnQ8es", j: 1528768999850, hasNextPage: true}
  </code></pre>