A few months ago I was faced with a bit of a problem.  A webpage I was writing was AJAX-based – meaning that it sent requests to and from the server asynchronously and would rewrite parts of the page as the server responded.  However if the server returns any kind of scripting code (including javascript) [...]