I’m trying to determine if I can use a line like:
if request.xhr?
do something
else
do something else
end
in my rails app, if I know that a particular method might be called by the .load() method in jQuery. So, is .load() XHR, or do servers treat it like a HTML request?
Thanks
I’m not sure what you mean by HTML request. Any request made to your web server is an HTTP request, however. I believe the
.xhr? method is just checking for theX-Requested-Withheader to be set toXMLHttpRequest.I believe
.load()does set that header (as all the other jQuery ajax methods do).