Coder Social home page Coder Social logo

Comments (11)

danielgrippi avatar danielgrippi commented on July 26, 2024

We are experiencing the same thing on diaspora with the most recent rails.js and remotipart.

It seems to be related to making handlRemote returning false before it gets bound, and then manually constructing the ajax call

if you were to expose the ajax object here

   // Allow remotipartSubmit to be cancelled if needed
         if ($.rails.fire(form, 'ajax:remotipartSubmit', [xhr, settings])) {
            // Second verse, same as the first
            $.rails.ajax(settings);
         }

we could then use it as a promise.

from remotipart.

danielgrippi avatar danielgrippi commented on July 26, 2024

there seems to be some weirdness where success isn't getting triggered, but complete is, in our app code we are doing this:

$('#new_photo').bind('ajax:complete', function(evt, xhr) {
  console.log(evt, xhr)
});

from remotipart.

JangoSteve avatar JangoSteve commented on July 26, 2024

Perhaps see if you can find a difference between your implementation and the remotipart demo app, as it works fine there.

from remotipart.

 avatar commented on July 26, 2024

@JangoSteve , It's working cause there's no callback of ajax:success on form[data-remote]; And it's using the JS on create.js.erb to achieve the .replaceWith().

.delegate('form[data-remote]', 'ajax:aborted:required, ajax:success', function(){
alert('there');

And by adding the ajax:success on the form[data-remote], you can reproduce it's not triggering the callback.

from remotipart.

 avatar commented on July 26, 2024

@danielgrippi confirmed that ajax:success not trigger but ajax:complete does. Tested on Demo app:

.delegate('form[data-remote]', 'ajax:aborted:required, ajax:success, ajax:complete', function(){
alert('there');

from remotipart.

 avatar commented on July 26, 2024

Same issue rails/jquery-ujs#256 (comment)

from remotipart.

 avatar commented on July 26, 2024

Oops, sorry. Not the same issue as this one ajax:success not trigger not just on replaceWith, it's not trigger when upload document...

from remotipart.

jgorset avatar jgorset commented on July 26, 2024

I, too, can confirm this behavior.

from remotipart.

mcfilib avatar mcfilib commented on July 26, 2024

I got around this in our app by listening to ajax:error and setting a specific status code in the controller. Ouch.

from remotipart.

JangoSteve avatar JangoSteve commented on July 26, 2024

This is now fixed in remotipart c1.0.3.

from remotipart.

mcfilib avatar mcfilib commented on July 26, 2024

👍

from remotipart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.