I am currently facing an issue where I need to wait for an ajax call to finish loading before moving on to the next step. I have tried using the waitForJS function, but I am struggling with building the JavaScript condition.
I have experimented with different conditions, but none of them seem to work. It is crucial for the ajax request to be fully loaded before proceeding to the next step.
$I->waitForJS(
15000,
"(function myJavascriptFunction() {
var hiddenField = document.getElementById('data-com_product_id');
if (hiddenField.value != '') {
return true;
} else {
return false;
}
})()"
);
Any suggestions or tips would be greatly appreciated. Thank you!