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

what is the difference between Active support’s “HashWithIndifferent” and Ruby’s “Hash” ?

587


List out what can Rails Migration do?

526


how you define Instance Variable, Global Variable and Class Variable in Ruby?

501


what are the differences between rails 2.x and rails 3?

501


What are the different components of rails ?

513






What are the hashes?

487


write a program to show the usage of sql in the database file?

496


what is rake in Rails?

527


How will be the future for ruby on rails?

480


Mention the role of rails controller.

496


How many types of associations relationships does a model have?

449


Explain the features of ruby on rails.

463


How you run your Rails Application without creating database ?

478


How are blocks created?

561


What is rails active record?

480