Posts: 9
Registered: ‎09-30-2016
Re: Accept.js - Exceptions regarding failure to load from CDN and bad CORS headers

Kris and Jeff, make sure your passing in a string for the second parameter for dispatchData and not the actual responseHandler method.


I'm coming from the Stripe world where you just pass in the responseHandler method and your done, but this requires you to pass in the name of the method as a string and then define the responseHandler as a global function that can then be found by window[c].


Kind of unorthodox and a pain to deal with, but once i adjusted for that I got it to work.


Invoking Call:

Accept.dispatchData(secureData, 'handleAuthnetResponse');

Note the second parameter is a string, not a variable.





  window.handleAuthnetResponse = function(response) {
    var error_messages = '';
    var error_container = '';

    if (response.messages.resultCode === 'Error') {
      for (var i = 0; i < response.messages.message.length; i++) {
        error_messages = error_messages + response.messages.message[i].code + ':';
        error_messages = error_messages + response.messages.message[i].text + '<br/>';

      error_container = '<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a>' + error_messages + '</div>';

      $authnetRoot.find('button[type=submit]').prop('disabled', false);
      $authnetRoot = null;
      return false;
    else {

      return true;


View solution in original post

Who Me Too'd this solution