title: casperjs: how to capture page in loop with ajax update
body: <p>I have a page that updates via ajax (so no page load) via a 'next' button.  I'd like to click the 'next' button (an onclick js function) and grab the page source each time and repeat this N number of times.</p>
  
  <pre><code>var casper = require('casper').create();
  var limit = 10, count = 0;
  
  casper.start('http://example.com');
  
  casper.then(function() {
  
  casper.repeat(limit, function() {
  
      this.echo(this.getHTML());
      this.echo('-------------------------');
      this.click('.next-btn');
      wait(2000);
      count++;
  
  });
  
  });
  
  casper.run();
  </code></pre>
  
  <p>This captures the source, but keeps getting the same source, not the updated markup from clicking the 'next' button.</p>