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 are the differences between rails 2.x and rails 3?

0 Answers  


What is the main difference between procs and blocks?

0 Answers  


Tell me what is rails migration?

0 Answers  


Can you explain me how rails implements ajax?

0 Answers  


What is the difference between false and nil in ruby?

0 Answers  






what is a rails migration? Write up a short example of a simple rails migration with a table called customers, a string column called name, and a text column called description?

0 Answers  


What is the naming convention for variables?

0 Answers  


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

0 Answers  


Explain about restful architecture?

0 Answers  


List out what can Rails Migration do?

0 Answers  


What is the difference between delete and destroy ?

0 Answers  


How will be the future for ruby on rails?

0 Answers  


Categories