Skip to content

Allowing full webpages in responses to AJAX requests

Ronald Chan edited this page Mar 8, 2012 · 1 revision

It is heavily discouraged to return the full webpage content when responding to an AJAX request. The inefficiencies stem from rendering parts of the webpage which is not needed on the webserver, as well as transmitting extra content.

However, the decision to allow this to occur is to make it easier to setup AJAX requests. The full webpage is what is normally returned. Therefore, in this way, no special code is required on the server-side to detect and respond appropriately.

It is of course not hard to set up the appropriate response because of the controller methods provided. However, users may appreciate being able to get it to work initially with one fewer step, so that they know that they are on the right track.

The reason given is why there is a javascript alert warning when a full webpage is returned. This warning appears by default only in the development environment, so that developers can be better educated or reminded, without affecting user experience in a production environment.