I'm trying to make a script that automatically starts uploading after the data has been enter in the database(I need the autoId that the database makes to upload the file).
When I run the javascript the scripts runs the php file but it fails calling the other php to upload the file.
too much recursion
setTimeout(testIfToegevoegd(),500);
the script that gives the error
send("/projects/backend/nieuwDeeltaak.php",'deeltaakNaam='+f.deeltaaknaam.value+'&beschrijving='+
f.beschrijving.value+'&startDatum='+f.startDatum.value+'&eindDatum='+f.eindDatum.value
+'&deeltaakLeider='+f.leiderID.value+'&projectID='+f.projectID.value,id);
function testIfToegevoegd(){
if(document.getElementById('resultaat').innerHTML == "<b>De deeltaak werd toegevoegd</b>"){
//stop met testen + upload file
document.getElementById('nieuwDeeltaak').target = 'upload_target';
document.forms["nieuwDeeltaak"].submit()
}else{
setTimeout(testIfToegevoegd(),500);
}
}
testIfToegevoegd();
sorry for the dutch names we have to use them it is a school project.
when I click the button that calls all this for a second time (after the error) it works fine.
setTimeout(testIfToegevoegd(),500);
should be
setTimeout(testIfToegevoegd,500);
you have to pass the function itself, not its result
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With