Made appendTo accepts functions

This is a small but convenient addition that makes appendTo accept functions (just like serviceUrl).