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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -