def index
@cellphones = Cellphone.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @cellphones }
end
-
SIMPLE ANSWERS PLEASE…
-
what is format.json used for?
-
do I have to create a view for it?
-
how does it relate to javascrip?
-
how does it relate to to ajax?
-
please give a simple example of how to use it…
-
@cellphonesas JSON. You may create a view, though, for example, using a JSON builder to customize the output beyond what Rails provides out of the box./cellphones.