The response string is returned in the callback. Just .split("|") it to 
get a javascript array. Then do whatever you need to in the response 
callback.

<script type="text/javascript">
     $.ajax({
         type: "POST",
         url: authNetURL,
         data: { ... }
     }).done(function( data ) {
             var parsedData = data.split("|");
             console.log( "Data Response:", data, "Parsed Response", 
parsedData);
             if (parsedData[0] == 1)
                 alert("SUCCESS\nCode: " + parsedData[0]);
             else
                 alert("FAILURE\nCode: " + parsedData[0] + "\nReason: " 
+ parsedData[3]);
     });

</script>


This is what the string data looks like coming back:
3|2|33|Credit card number is 
required.||P|0|||0.00|CC|auth_capture||||||||||||||||||||||||||7A27F022C6CA581165E16ED2D88F2135||||||||||||||||||||||||||||||


The meanings of the columns returned are in the Authorize.net docs and 
can also be found starting at line 423 of this file, but remember CF 
uses 1 based indexes while JS uses 0 based.

http://svn.riaforge.org/cfpayment/trunk/api/gateway/authorizenet/authorizenet.cfc

On 9/22/12 10:16 PM, Rick Faircloth wrote:
> All that's quite beyond me, Jonah.  Partly because
> I don't make use of the createObject() methodology,
> so I don't understand it very well. The other part, is, well,
> I just don't understand how to apply everything in the docs.
>
> I guess I'll just need to talk to Authorize.net on Monday
> and see if they know what I need to make this work. I just
> don't know how to handle the data they send back; a pipe-delimited
> list of all transaction information.
>
> I'm not sure what it's called. Using CFHTTP, all of that is contained
> in cfhttp.fileContent. With that I know how to access the data in
> the delimited string they return.
>
> Using jQuery AJAX to submit my form, I'm not sure what variable
> (like filecontent for cfhttp) it would come in so I can reference it.
>
> Does that make sense?
>
> Rick


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352729
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to