Closed amalagaura closed 8 years ago
I did some more debugging in Chrome and my form does have the following event listeners
There is something else weird because I am not able to listen to other events. The form submits but I am not able to listen to events.
$('#survey-fields-save').on('ajax:beforeSend', function(e,x,s) { alert('hello') });
does not give me anything. I tried attaching directly to the form.
I think it is a rails_ujs
problem, I don't think any of the events are firing. I am putting console debugging, but not getting any events firing, only "submit', but no ajax related events.
@amalagaura Well, I see, that Growlyflash's listener catchs the right event, so an alert must be created... Please, try the latest release (0.8.4.1) and set Growlyflash.debug = true
to enable logs in JS console. Also, try to create a notification by running Growlyflash.notice("Test")
and look at the DOM tree to watch what's going on there.
Thank you for your help. I don't think the issue is in your library now. If I do a manual trigger: $(document).trigger('ajax:complete')
I see the growlyflash code being triggered (it fails in this instance because the event is not complete).
But I am simply not getting event triggers from ajax forms. I can attach any listener, but they are not firing. I have a pretty simple rails app. I did upgrade from rails 3 so let me see if I am missing something. I may try it in a brand new 4.2.5 app.
I found my problem, I isolated it to my including datatables stuff and I was incorrectly double loading jquery and even bootstrap (I had to pay more attention when generating the CDN link). When I fixed that the events started being generated properly again.
Thanks for fixing the earlier issue. Static flashes are working now.
I am not seeing AJAX flashes in spite of getting the X-Message: Header in the response. I am using data-remote on a form POST submit link. Maybe the event names have changed. I tried some breakpoints in the listener, but it does not get triggered. I am using Rails 4.2.5 without turbolinks.
I have
use_growlyflash
in my application_controller and am getting the X-Message: X-Message:%7B%22notice%22:%22Succesfully%20saved%20Field%20Values%22%7D