I borrowed this function from http://sorgalla.com/projects/jcarousel/examples/dynamic_flickr_feed.html
function mycarousel_decodeEntities(s) { return s.replace(/&/g, "&") .replace(/"/g, '"') .replace(/'/g, "'") .replace(/</g, "<") .replace(/>/g, ">"); }; and I'm trying to use it in my code here: function mycarousel_itemLoadCallback(carousel, state) { $.getJSON("http://localhost:59396/xxx/xxxHandler.ashx? action=cjson", function(data) { $.each(data, function(i, item) { carousel.add(i, mycarousel_decodeEntities(item)); if (i == 3) return false; }); }); }; for some reason I get an error in firebug saying this: s.replace is not a function [Break on this error] return s.replace(/&/g, "&") I know I've used this very same code before and the only difference was that I changed some JSON that is returned but it's valid json.