Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events for data-remote requests not firing #406

Open
jogaco opened this issue Feb 24, 2015 · 1 comment
Open

events for data-remote requests not firing #406

jogaco opened this issue Feb 24, 2015 · 1 comment

Comments

@jogaco
Copy link

jogaco commented Feb 24, 2015

I'm using $rails.handleRemote to run remote calls on dynamically created remote links.
However, even though I attach these links to the document, none of the events ajax:complete, ajax:success, ajax:error are fired.
My controller returned javascript and updated the page accordingly but I changed it to return html content it so I can better handle user input errors and so on in the ajax:success and suchlike events.

I tried adding

    $(document).delegate('a[data-remote]', 'confirm:complete', function(e, answer) {
        console.log('confirmed!', answer);
    }).delegate('a[data-remote]', 'ajax:before', function() {
        console.log('sending!');
    }).delegate('a[data-remote]', 'ajax:complete', function() {
        console.log('complete!');
    }).delegate('a[data-remote]', 'ajax:success', function() {
        console.log('success!');
    });

but nothing shows up.

No javascript errors are shown on the console either.

During debugging I have seen the line is run, but the event is not fired!

success: function(data, status, xhr) {
            element.trigger('ajax:success', [data, status, xhr]);
          },

Any tip to narrow down the problem?

@ericdfields
Copy link

Hi. Just saw this. I wonder if it's related to what I just filed: #408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants