Factor out wrapping response text in textarea

The jQuery Iframe Transport can't access the status code or content type
of the request targeted to the iframe. It provides a mechanism to fake
this by wrapping the response body in a textarea element with various
properties set as data attributes on the element.

I use this to wrap the JSON output and broke out the code that generates
the textarea output into a separate method anticipating using this in
other cases, such as wrapping error responses.

Addresses #595