Issue: When using ajax driven pagination to load canvas based portfolio items, script tags are not within the canvas tags.
Attempted Solution: Tried placing script tags before canvas tags, but scripts still did not load (seems to be a loading script issue).
Investigation: Discovered that it is a security issue preventing the retrieval of scripts when using ajax calls, referred to this Stack Overflow post on "jquery script not working".
Potential workaround: Considering adding canvas content from outside canvas tags, but faced with challenges in passing dynamically created portfolio title tags.
Code:
<ul id="products-list">
<?php
$i = 0;
while($the_list->have_posts()): $the_list->the_post(); //wordpress loops through posts
?>
<li class="product-item<?php echo $i;?>">
<script>functionForMakingACanvasOverlayUsingThePostTitle("<?php echo get_the_title() ?>");</script>
<canvas></canvas>
</li>
<?php $i++; ?>
<?php endwhile; ?>
</ul>
The current setup displays 6 items per page and uses ajax for loading the next set of 6 items.
Any suggestions or advice would be greatly appreciated. Thank you.