Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML - What does data-remote="true" do?

Tags:

html

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.

like image 746
Isaac Avatar asked Feb 05 '15 22:02

Isaac


People also ask

What does remote true mean in rails?

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.

What is Rails Ujs?

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.


2 Answers

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

like image 151
mahi-man Avatar answered Oct 12 '22 20:10

mahi-man


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.

like image 44
c-smile Avatar answered Oct 12 '22 20:10

c-smile