I have the following:
for(var i = 0; i < triggerCount; i++) {
<?php $me = i; ?>
console.log(<?php echo $me; ?>);
jQuery('[data-key="field_5ee8665e2cd7f"] .acf-input .acf-actions [data-event="add-row"]').trigger('click');
jQuery('#ItineraryTab .acf-row input').eq(i).val("<?php print_r($array[$me]); ?>");
}
Which loops through a triggerCount variable and sets the input to each value in the array. However, if I use print_r($array[0]); then it shows uses this value from the array and places it into every iteration. How can I loop through this $array so similar to the count it places each value in order into each input in order?
$medefined? how about$iid?var array = <?= json_encode($array) ?>;once and don't mix PHP with JS after it.i(js) directly to$me(php). PHP executes on server side. Browser will execute javascript after he received all the content from the server meaning meaning php execution has finished already.