Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript函数向struts操作类发送两次请求_Javascript_Ajax - Fatal编程技术网

Javascript函数向struts操作类发送两次请求

Javascript函数向struts操作类发送两次请求,javascript,ajax,Javascript,Ajax,我有一个JS函数,它向action类发送两次请求。我不确定我应该在哪里修改它来解决这个问题 下面是JS函数。问题出在它的其他部分,我正在检查runNoEmail==1&&runEmail==0 为了更好地理解,我提供了完整的JS函数 function runReportCheck(obj){ obj = window.event.srcElement; if(runEmail==1 && runNoEmail==0) {

我有一个JS函数,它向action类发送两次请求。我不确定我应该在哪里修改它来解决这个问题

下面是JS函数。问题出在它的其他部分,我正在检查runNoEmail==1&&runEmail==0 为了更好地理解,我提供了完整的JS函数

function runReportCheck(obj){
     obj = window.event.srcElement;  
     if(runEmail==1 && runNoEmail==0) 
        {
         openPopupWindow('popupType:Working');          
         runEmail=0;
             var opt = {
                     method: 'post',
                     parameters: $('formLicStrands').serialize(true),
                     onSuccess: function(t) {                 
                     destroyPopupWindow();                                                 
                             if(t.responseText=="-2"){  
                                openPopupWindow('title:Error; message: Conflict report is already being run.Please try again later.; popupType: Error; button1Value: OK;  topRightClose: false',obj);                                                   
                                 return;          
                             }else                               
                               if(t.responseText=="-3"){
                                openPopupWindow('title:Warning; message: The conflict report will run and save in the background.An email will be sent to you upon completion.; popupType: Warning; button1Value: OK;  topRightClose: false',obj);                                
                                return;
                                    }  
                               else
                               {  openPopupWindow('title:Run And Email Issue Report; URL:<c:url value="/secure/deal/conflict/newReport.dooo?"/>;formToSubmit:formLicStrands;topRightClose: false;onTitleBarCloseFunction:onConflictReportClose(<c:out value="${DEAL_BRIEF.ventanaId}"/>)',obj);  
                                }
                               return;                                            
                     },
                     onFailure: function(t) {
                         alert('Error ' + t.status + ' -- ' + t.responseText);
                     }
                 }          
                 new Ajax.Request("<%=request.getContextPath()%>/secure/deal/conflict/newReport.dooo?isRunEmailClicked=true",opt);
                 return false;
        } 
        else if(runNoEmail==1 && runEmail==0) 
        {       
         openPopupWindow('popupType:Working');          
         runNoEmail=0;
             var opt = {
                     method: 'post',
                     parameters: $('formLicStrands').serialize(true),
                     onSuccess: function(t) {                 
                     destroyPopupWindow();                                                 
                             if(t.responseText=="-11"){ 
                                openPopupWindow('title:Error; message: Conflict report is already being run.Please try again later.; popupType: Error; button1Value: OK;  topRightClose: false',obj);                                                   
                                 return;          
                             } 
                               else
                               {
                                   openPopupWindow('title:Run Issue Report; URL:<c:url value="/secure/deal/conflict/newReport.dooo?"/>;formToSubmit:formLicStrands;topRightClose: false;onTitleBarCloseFunction:onConflictReportClose(<c:out value="${DEAL_BRIEF.ventanaId}"/>)',obj);  
                                }
                               return;                                            
                     },
                     onFailure: function(t) {
                         alert('Error ' + t.status + ' -- ' + t.responseText);
                     }
                 }          
                 new Ajax.Request("<%=request.getContextPath()%>/secure/deal/conflict/newReport.dooo",opt);
                 return false;
        }else {         
            openPopupWindow('title:Run Issue Report; URL:<c:url value="/secure/deal/conflict/newReport.dooo?"/>;formToSubmit:formLicStrands;topRightClose: false;onTitleBarCloseFunction:onConflictReportClose(<c:out value="${DEAL_BRIEF.ventanaId}"/>)',obj);
            }
    return;}
函数runReportCheck(obj){
obj=window.event.src元素;
如果(runEmail==1&&runNoEmail==0)
{
openPopupWindow('popupType:Working');
runEmail=0;
变量opt={
方法:“post”,
参数:$('FormlicStreams')。序列化(true),
onSuccess:函数(t){
破坏PopupWindow();
如果(t.responseText==“-2”){
openPopupWindow('标题:错误;消息:冲突报告已在运行。请稍后重试。;popupType:错误;按钮1值:确定;topRightClose:false',obj);
返回;
}否则
如果(t.responseText==“-3”){
openPopupWindow('标题:警告;消息:冲突报告将在后台运行并保存。完成后将向您发送电子邮件。'popupType:警告;button1Value:确定;topRightClose:false',obj');
返回;
}  
其他的
{openPopupWindow('标题:运行和电子邮件问题报告;URL:;formToSubmit:FormlicStreams;topRightClose:false;onTitleBarCloseFunction:onConflictReportClose()',obj);
}
返回;
},
onFailure:函数(t){
警报('Error'+t.status+'--'+t.responseText);
}
}          
新的Ajax.Request(“/secure/deal/conflict/newReport.dooo?isRunEmailClicked=true”,opt);
返回false;
} 
else if(runNoEmail==1&&runEmail==0)
{       
openPopupWindow('popupType:Working');
runNoEmail=0;
变量opt={
方法:“post”,
参数:$('FormlicStreams')。序列化(true),
onSuccess:函数(t){
破坏PopupWindow();
如果(t.responseText==“-11”){
openPopupWindow('标题:错误;消息:冲突报告已在运行。请稍后重试。;popupType:错误;按钮1值:确定;topRightClose:false',obj);
返回;
} 
其他的
{
openPopupWindow('标题:运行问题报告;URL:;formToSubmit:FormlicStreams;topRightClose:false;onTitleBarCloseFunction:onConflictReportClose()',obj);
}
返回;
},
onFailure:函数(t){
警报('Error'+t.status+'--'+t.responseText);
}
}          
新的Ajax.Request(“/secure/deal/conflict/newReport.dooo”,opt);
返回false;
}否则{
openPopupWindow('标题:运行问题报告;URL:;formToSubmit:FormlicStreams;topRightClose:false;onTitleBarCloseFunction:onConflictReportClose()',obj);
}
返回;}

到底是什么问题?我的action类从其他部分调用了两次。我想阻止它。它应该只调用一次。看起来您的条件与
if(runNoEmail==1&&runEmail==0)
else if(runNoEmail==1&&runEmail==0)
相同。它们看起来都是firingNo如果(runEmail==1&&runNoEmail==0)和else如果(runNoEmail==1&&runEmail==0)它们是不同的