应用程序挂起并获取状态在调用rest函数调用时挂起

时间:2015-01-15 13:25:27

标签: javascript rest coldfusion

Coldfusion版本10。 当我从js文件执行REST cf函数调用时,应用程序使用IE9挂起。观察控制台,我看到待处理状态。但是,它在IE,Chrome和Mozilla的更高版本中运行良好。

当我将cffunction httpmethod从DELETE更改为PUT时,它工作正常。所以,我认为可能是javascript函数调用和cffunction头不匹配。


这是cffunction;

<cffunction output="no" name="zeroUpdateCredits" access="remote" produces="application/json"  consumes="application/json" returnType="struct" httpmethod="DELETE">
  <cfargument name="DATA" type="struct" required="yes"/>
  <cfset var retStatus = StructNew() />
  <cfset retStatus["success"] = true />

  <cftry>
  <cfset var qSponsDetails = APPLICATION.cfc.properties.getsettings(DATA.employee_id)>

  <cfif qSponsDetails.allow_credits>
    <cfset temp = saveCredits(credits = 0, employee_id = DATA.employee_id, effective_date = DATA.effective_date)>
  </cfif>

  <cfcatch type="any">
    <cfthrow errorcode="401" message="error zero credits" />
    <cfreturn>
  </cfcatch>
  </cftry>                  

  <cfreturn retStatus>
  </cffunction>

这是函数调用:

exports.clearCredits = function(employeeId, effectiveDate){
 data = {
    employee_id: employeeId,
    effective_date: effectiveDate
};

var promise = rest.DELETE({
  url: appConfig.restPrefix + 'selections/unusedcredits?t=' + new Date().getTime(),
  contentType: 'application/json'
 }, JSON.stringify(data)
);
return promise;
};

谢谢你, 颊

0 个答案:

没有答案