Why do we use request.xhr? in rails

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how Rails implements Ajax?

471


Explain the various ide's of ruby on rails.

455


what is ORM (Object-Relationship-Model) in Rails?

547


Explain what is the role of the subdirectories app/controllers and app/helpers in rails?

496


Explain the importance of yield statement in rails.

493






how you can create a controller for subject?

505


what is Cross-Site Request Forgery (CSRF) and how Rails is protected against it?

496


Explain rails migration.

535


What are float, dig and max?

647


How can you protect filter methods in rails?

477


What are the steps involved in writing and setting up an application in ruby on rails?

446


Explain unobtrusive javascript in rails.

496


what is the difference between the Observers and Callbacks in Ruby on Rails?

511


What is a ruby singleton method ?

505


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

495