Why do we use request.xhr? in rails

Answers were Sorted based on User's Feedback



Why do we use request.xhr? in rails..

Answer / surekha matte

request.xhr? indicates the controller has
received an ajax request. It returns true or false

Is This Answer Correct ?    71 Yes 8 No

Why do we use request.xhr? in rails..

Answer / moin haidar

Conventional web application transmit information to and
from the sever using synchronous requests. This means you
fill out a form, hit submit, and get directed to a new page
with new information from the server.
When you interact with an Ajax-powered web page, it loads an
Ajax engine in the background. In response to an event web
application passes asynchronous request (XMLHttpRequest or
xhr). In fact it is javaScript object/method that performs
asynchronous interaction with the server, JavaScript object
that performs asynchronous interaction with the server and
behind the scene fetches data. and behind the scene fetches
data.
We do request.xhr? only to check the request type, either
its AJAX request or others(post, get).

Is This Answer Correct ?    43 Yes 11 No

Post New Answer

More Ruby on Rails Interview Questions

what is the purpose of RJs in Rails?

0 Answers  


Write a program to generate and run the application without the use of database

0 Answers  


how many types of callbacks available in ror?

0 Answers  


What I have to do to view my project always on browser?

0 Answers  


what is active record?

0 Answers  






Explain the controller in rails?

0 Answers  


Explain valid and invalid in rails?

0 Answers  


What do you mean by render and redirect_to?

0 Answers  


Explain how does rails implement ajax?

0 Answers  


Choosing between belongs_to and has_one?

0 Answers  


What is the main difference between procs and blocks?

0 Answers  


Explain unobtrusive javascript in rails.

0 Answers  


Categories