<div class="center-align">
  <div id="mainContainer">
    <input type="button" id="start" value="Add Bank">
  </div>
</div>

<div id="iavContainer"></div>

<script type="text/javascript">
$('#start').click(function() {
  var iavToken = "<%= @token %>";
  dwolla.configure('sandbox');
  dwolla.iav.start(iavToken, {
          container: 'iavContainer',
          stylesheets: [
            'http://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext',
            'http://localhost:8080/iav/customStylesheet.css'
          ]
        }, function(err, res) {
    console.log('Error: ' + JSON.stringify(err) + ' -- Response: ' + JSON.stringify(res));
    var ajaxFunc = $.ajax({
      url: "<%= user_path(@user) %>",
      method: 'PUT',
      dataType: 'json',
      data: {user: {dwolla_url: res}}
    });

    ajaxFunc.done(function(response) {
      console.log(response);
      location.replace("<%= user_path(@user) %>")
    });
    ajaxFunc.fail(function(response) {
      console.log("shits broke fam");
    });

  });
});
</script>


<div class="center-align">
  <div id="mainContainer">
    <input type="button" id="start" value="Add Bank">
  </div>
</div>

<div id="iavContainer"></div>

<script type="text/javascript">
$('#start').click(function() {
  $(this).hide();
  var iavToken = "<%= @token %>";
  dwolla.configure('sandbox');
  dwolla.iav.start(iavToken, {
          container: 'iavContainer',
          stylesheets: [
            'http://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext',
            'http://localhost:8080/iav/customStylesheet.css'
          ]
        }, function(err, res) {
    console.log('Error: ' + JSON.stringify(err) + ' -- Response: ' + JSON.stringify(res));
    var ajaxFunc = $.ajax({
      url: "<%= user_path(@user) %>",
      method: 'PUT',
      dataType: 'json',
      data: {user: {dwolla_url: res}}
    });

    ajaxFunc.done(function(response) {
      console.log(response);
      setTimeout(
        function() {
          location.replace("<%= user_path(@user) %>");
        }, 3000);
    });
    ajaxFunc.fail(function(response) {
      console.log("shits broke fam");
    });

  });
});
</script>


Add delay to redirect in user banking edit page
Add delay to redirect in user banking edit page
