1 Dernière modification par amaseb57 (17-09-2015 15:40:03)

Sujet : JQUERY AJAX fonction success retourne “UNDEFINED” avec CFC query

<cfcomponent output="false">
    <cffunction name="getTransports" access="remote" returnFormat="json"  returnType="Array">
        <cfargument name="VIL_CD_DEST" type="string" required="yes">  
        <cfargument name="VIL_CD_ORIG" type="string" required="yes"> 
 
 
    <cfquery name ="transport" datasource="#application.datasource#">
    <!---Query Transports--->
        select * from APP_GEN_CODE_T where ST_CLASS_CODE = 'BUD_CTRP'
    </cfquery>
 
    <cfset transports = arrayNew(1)>
 
    <cfloop query="transport">        
 
        <cfquery name="defined_transport" datasource="#application.datasource#">
            select * from TABLE_FRAIS 
            where VIL_CD_DEST = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.VIL_CD_DEST#">
            and VIL_CD_ORIG = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.VIL_CD_ORIG#">
            and CTRP_ST_CODE = '#transport.ST_CODE#'    
        </cfquery>
 
      <cfif defined_transport.recordCount eq 0>
        <cfset transport_value = "#transport.ST_DESCRIPTION# (not defined)">
      <cfelse>  
        <cfset transport_value = "#transport.ST_DESCRIPTION#">
      </cfif>
 
        <cfset transports[currentRow]["ID"] = #transport.ST_CODE#>
        <cfset transports[currentRow]["VALUE"] = #transport_value#>
    </cfloop>
 
        <cfreturn transports>
    </cffunction>
</cfcomponent>