This is more tricky than it should be because url_for, asset_path, etc. all rely on different mechanisms.

Attached (see below) is some code to allow using unobtrusive JavaScript on pages fetched with an AJAX call.