0๐
You can submit the form using axios. But to prevent default form submission with full page refresh you would need to add .prevent modifier in submitting button
<button @click.prevent="methodCall">Submit</button>
0๐
I ran into a similar problem and ended up here looking for a solution. Not sure if this will fix this particular case (I am not using vuejs), but I discovered that if I was getting a blank page after a POST and successful GET redirect, the problem was due to the X-XSS-Protection
header, which defaults to 1
in Rails. That header tells the browser to not load anything on a page that tries to run the same scripts that were submitted in the POST. So perhaps some of your javascript is being posted in the request?
In my case I have a CMS that allows iframe embeds, but when someone updated a page with an iframe in it, it appeared successful on the server but failed to load in the browser. The workaround I found was:
class PagesController < ApplicationController
before_filter :disable_xss_protection
...
private
def disable_xss_protection
# allows a page to display after an iframe or javascript was submitted in the post
response.headers['X-XSS-Protection'] = "0"
end
end
Warning: Disabling cross-site-scripting protection is dangerous, so I would only use this approach in a situation where you have 100% protection against malicious users reaching the controller.