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

Not getting AJAX flashes #27

Closed
amalagaura opened this issue Jan 6, 2016 · 6 comments
Closed

Not getting AJAX flashes #27

amalagaura opened this issue Jan 6, 2016 · 6 comments

Comments

@amalagaura
Copy link

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.

image

image

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

@amalagaura
Copy link
Author

I did some more debugging in Chrome and my form does have the following event listeners

image

@amalagaura
Copy link
Author

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.

@amalagaura
Copy link
Author

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.

@estum
Copy link
Owner

estum commented Jan 6, 2016

@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.

@amalagaura
Copy link
Author

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.

@amalagaura
Copy link
Author

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.

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