problem in calling cgi from javascript -


i executing cgi file directly javascript onclick of button. cgi return doc, xls, exe etc file in turn opens savaas dialog let client save file on machine. problem comes when multiple cgi files executing in for/while loop, executes first cgi , opens saveas dialog, once saveas opens not enter "for" loop again execute cgi opens saveas dialog .

here code fragment -

for(i = 0; < datapopup.elements['checkbox'].length; i++)       {     j=0;     obj = datapopup.elements['checkbox'];     if(obj[i].checked)     {         var temp=obj[i].value;         temp = temp.split(".");         if(temp[1] == "txt")         {             savewins[temp[1]] = settimeout("document.location='../cgi/savetextfile.cgi?fname=070319185708701_1'", 100);         }         else if(temp[1] == "pdf")         {             savewins[temp[1]] = settimeout("document.location='../cgi/savepdffile.cgi?fname=065726729272220_1'", 100);         }         else if(temp[1] == "xls")         {             savewins[temp[1]] = settimeout("document.location = '../cgi/savexlsfile.cgi?fname=288433243743'", 100);         }         else if((temp[1] == "doc") || (temp[1] == "docx"))         {             savewins[temp[1]] = document.location = '../cgi/savedocfile.cgi?fname='+temp[0];         }         savewins[temp[1]].focus();     } } 

please help.

setting document.location replaces current document new document - if it's download. means there no longer script continue execute.

you'll need set location of iframe instead.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -