I have a cfc that is called from JS that returns a string, works
perfectly on CF6 but is not working on CF7. My JS and cfc are below.
Again this exact code is working on my beta server with CF6 on it. The
production server is set up the same besides having CF7. When I try to
alert(result) on CF6 I get the correct value, when I do it on CF7 I get
a blank/empty value like the cfc was never called. If I do a
alert(objHTTP.status) after the objHTTP.send(null) I get a result of 200
 
var PromoCode = document.SubscriberForm.SpecialOfferCode.value;
   
   <CFOUTPUT>
   var strURL =
"#Request.webroot#Ajax/MyFunctions.cfc?Method=FindPromoCode&SubType=1&Th
ePromoCode=" + PromoCode;
   </CFOUTPUT>
 
   if(window.XMLHttpRequest) {    
    objHTTP = new XMLHttpRequest();
    objHTTP.open("GET", strURL, false);     
    objHTTP.send(null);   
    result = objHTTP.responseText; 
   }
   else if (window.ActiveXObject) {    
    objHTTP = new ActiveXObject("Microsoft.XMLHTTP");  
    objHTTP.open("GET",strURL,false);
    objHTTP.send(null);
    result = objHTTP.responseText;   
   } 
  
   var PromoCodeFound = result.substring(57,58); 
   
  
   if(PromoCodeFound == 1) {    
    return true; 
   }
   else if(PromoCodeFound == 2) {
    //alert("The promotion code entered is for a monthly subscription
you are signing up for a Pay-Per-Pick subscription.\n\n Please try
again.");
    return true;
   }
   else {   
    //alert("The promotion code entered was not found.\n\n Please try
again.");
    return true;
   }
 
This is my CFC
 
<cfcomponent>
 
<!--- Function to check the Promo Code --->
<CFFUNCTION name="FindPromoCode" returntype="string" output="no"
access="remote">
 <CFARGUMENT name="ThePromoCode" required="yes" type="string">
 <CFARGUMENT name="SubType" required="yes" type="string">
 
 <CFQUERY name="FindPromoCode" datasource="#request.dsource#" >
  SELECT SubscriptionType
  FROM SpecialOffers
  WHERE PromoCode = '#Arguments.ThePromoCode#'
 </CFQUERY> 
 
 <CFSET IsFound = 0 />
  
 <CFIF FindPromoCode.recordcount GT 0 AND FindPromoCode.SubscriptionType
IS NOT "">
   
  <CFIF Arguments.SubType EQ FindPromoCode.SubscriptionType>
   <CFSET IsFound = 1 />
  <CFELSE>
   <CFSET IsFound = 2 /> 
  </CFIF>      
 </CFIF>
 
 <cfreturn IsFound />
 
</CFFUNCTION>
 

</cfcomponent>
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284383
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to