I was just working on a project that was sending an extra request and it was because of data-remote="true"
. I've seen this line plenty of times before, but I guess I don't really know what it does. I tried Googling it but all that comes up are specific examples where data-remote isn't working for the question asker.
I just want to know what the purpose of data-remote="true"/"false"
is to get a better understanding of it.
remote: true is really just telling the browser to not refresh the page. Do the action that you would normally do, but don't do anything to the page.
Rails UJS (Unobtrusive JavaScript) is the JavaScript library that helps Rails do its magic when we use options like remote: true for many of the html helpers. In this article I'll try to explain the main concept of how this works to make it transparent for the user.
data-remote = "true" is used by the Ruby On Rails framework to submit the form/link/button as an ajax request. If you are interested here is the guide discussing how Ruby on Rails works with javascript: http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html
It is definitely not a standard thing.
Usually data-***
is a custom attribute used on application level. So check in sources of your scripts - it is used by some code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With