question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onReady not firing?

See original GitHub issue

We’re using Hosted Forms and I’m seeing an issue for ~5% of our users where the payment form does not seem to load.

I am hiding the form via CSS while it is loading and then, when the onReady event fires, the form is displayed. This works fine for the majority of our users, but for about 5%, the onReady event does not seem to fire.

Here’s part of the view code:

<%= javascript_include_tag "https://js.braintreegateway.com/js/braintree-2.19.0.min.js" %>
<script>
  braintree.setup("<%= Braintree::ClientToken.generate %>", "custom", {
    id: "braintree-form",
    onReady: function(event) {
      RS.braintree.displayForm();
    },
   ...

The call to RS.braintree.displayForm() points here:

displayForm: function() {
  this.formLoaded = true;
  $('#payment-wrapper').fadeIn('fast');
  $('#payment-loading').hide();
},

A little more info: On document.ready, I set an interval which checks every 1/2 second to see if this.formLoaded has been set to true. If after 50 seconds, it has not been set, it notifies me and the customer that the payment form could not be loaded and that they should try refreshing the page.

On occasion, they will refresh the page and it works. They’ll be able to see the form and submit a payment. More often, I can see in the logs that they refresh the page multiple times without success. The 5% of users this affects is all over the place when it comes to browser, OS, and geographic location.

I’m at a bit of a loss as to what could be causing this. Is it an issue with my code?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rickhallcommented, Apr 12, 2016

Why close this when taken out of band? I’m still interested in reading about the conclusion, since I am experiencing a similar issue.

0reactions
mrakcommented, May 25, 2016

We’ve released a beta of our next major version. One predominant feature of this new version is that we no longer rely on forms. All SDK actions are programmatically triggered and manually bound. Hopefully this helps with common single page application use cases.

Here are some links to our official documentation:

Setup for v3 Migrating from v2 to v3

Please send any beta feedback to js-sdk-beta@braintreepayments.com

Read more comments on GitHub >

github_iconTop Results From Across the Web

YouTube API onPlayerReady not firing - Stack Overflow
A quick fix is to add in the origin=http://www.example.com (replace with your servers full domain; make sure you use http:// or https:// as ......
Read more >
Wix code $w.onReady(...) not firing | Velo by Wix
I understand how to implement Mixpanel; that is not the issue. But once implemented, using the instructions mentioned, it prevents $w.onready() from firing....
Read more >
YouTube API events like onReady onStateChange are not ...
YouTube API events like onReady onStateChange are not firing in FF as of 1292014. This essentially hides the caption when the video is...
Read more >
YouTube iframe API – onReady and onStateChanged events ...
YouTube iframe API – onReady and onStateChanged events not firing ... to work… the events "onready" and "onstatechange" don't appear to be firing...
Read more >
YT.Player isn't working when loading a video ... - Issue Tracker
Issue summary: I'm using the youtube iframe api to track video events, and since late last week it is no longer working. I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found