Wicked_PDF和JS

I am trying to execute some ajax requests in the pdf.html file for a ruby app using WickedPDF. I have the javascript outputting some append statements to keep track of the functions reached.

The first ajax call is successful, as I have outputted the json result in the pdf file. However, in that same success call, I call another function, which for now, I only have it outputting an append statement to indicate it is being executed. However, it does not happen. Any ideas?

HTML:

<div id="data"></div>

Javascript:

<script>
  function getData(data) {
    $('div#data').append('<p>getData function called</p>');
  }
</script>
<script>
  $(function() {
    var assays = '';
    $.ajax({
          type: 'GET',
          url: 'http://www.url.com/data.json'
        })
        .done(function(result) {
          $('div#data').append('<p>First ajax call called!</p>');
          data = result['DataList']['list'];
            getData(data);
          })
        .fail(function() {
          $('div#data').append('<p class="center">Data is unavailable.</p>');
        });
  });
</script>

Thanks for your help.

wkhtmltopdf will by default stop slow running JavaScripts if they are delaying rendering.

Try experimenting with the following options: --no-stop-slow-scripts, --javascript-delay <msec>

More options are listed here