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

How you run your rails application without creating databases?

446


What are the different types of association relationships that exist?

530


What is the purpose of load, auto_load, and require_relative in ruby ?

451


What is the process for creating a controller for the subject? What is its role?

439


What does session and cookies represent in ruby on rails?

415






what is the difference in scope for these two variables: @@name and @name?

444


what is the defined operator?

605


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

440


Explain the controller in rails?

466


List out what can Rails Migration do?

505


How does router work in rails?

446


What is the purpose of auto_load in ruby?

488


How can the filter methods in ruby on rails be protected?

446


Explain how you can run rails application without creating databases?

435


Explain about restful architecture?

462