You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the instructions in the README, I made a search form that sends an AJAX request and everything was working fine at first, together with the turbolinks. However, I noticed that every time I submitted the form, there was one additional and identical cancelled AJAX request. The requests were piling up so this started slowing the page down eventually.
The solution that I found was moving the <script src="<%= static_path(@conn, "/js/app.js") %>"></script> in app.html.eex from the body to the head.
Maybe there's a better solution. I'm not sure if Turbolinks.clearCache() could work - tried using it to no avail (maybe I tried the wrong approach though). In any case, I think this issue should be discussed.
The text was updated successfully, but these errors were encountered:
NicolayD
changed the title
Multiple AJAX requests whit a remote form
Multiple AJAX requests (one successful and the rest cancelled) with a remote form
Dec 7, 2017
I've updated the README, I hope this clarifies it:
head
++ meta name="csrf-token" content="#{get_csrf_token()}"++ meta name="csrf-param" content="_csrf_token"
...
-- script src="#{static_path(@conn, "/js/app.js")}"++ script data-turbolinks-track="reload" src="#{static_path(@conn, "/js/app.js")}"
...
body
...
Following the instructions in the README, I made a search form that sends an AJAX request and everything was working fine at first, together with the turbolinks. However, I noticed that every time I submitted the form, there was one additional and identical cancelled AJAX request. The requests were piling up so this started slowing the page down eventually.
The solution that I found was moving the
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
in app.html.eex from the body to the head.Maybe there's a better solution. I'm not sure if Turbolinks.clearCache() could work - tried using it to no avail (maybe I tried the wrong approach though). In any case, I think this issue should be discussed.
The text was updated successfully, but these errors were encountered: