javascript too much recursion?
Posted
by Ken
on Stack Overflow
See other posts from Stack Overflow
or by Ken
Published on 2010-03-03T13:55:42Z
Indexed on
2010/06/11
11:03 UTC
Read the original article
Hit count: 311
Hi,
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.
© Stack Overflow or respective owner