in one project of mine, the code:
= link_to \"add\", new_me_category_path, class: \"btn btn-success\", remote: true
can load remote form
Behind the scenes, jQuery's ajax
method is used: http://api.jquery.com/jquery.ajax/ by uJS https://github.com/rails/jquery-ujs whenever the data-remote="true"
attribute of the link is set, which is done by remote: true
.
As stated in the documentation, Ajax determines the HTTP Accepts header sent and interprets the return value based on the dataType
and accepts
arguments passed to ajax()
, which here are taken from the data-
attributes of the anchor by uJS.
If no dataType
is set through the data-type
attribute, jQuery inferences the request and response type "intelligently". This can explain inconsistencies if you do not explicitly specify it.