blog.craiga.id.au — jQuery.getStylesheet

Just a quick brain dump which may be useful to someone searching for the same thing I was. Enjoy.

function getStylesheet(url, callback) {
   jQuery.get(url, function(data, status) {
        if(status == "success") {
            jQuery("head").append(
                    "<style type=\"text/css\">" +
                    data + "</style>");
        }
        callback(data, status);
    });
};

Published: Friday, 16th October 2009 at 2:39 PM

Related

About Craig Anderson

By day, he works for 99des­igns as a web dev­el­oper and wri­ter. By night, he plays bass gui­tar in Look Who's Tox­ic. There are plen­ty of other things he should be doing, but most of the time he's dream­ing of what he'll do when he grows up while watch­ing bad Star Trek spin-offs.