$("#autoNames").html(function (index, html) {
var begin = "<script language='javascript' type='text/javascript'> var names = [";
var end = String('];' + '<' + '/' + 'script' + '>');
var result = begin.concat(jsonService, end);
$("#autoNames").html(result);
return false;
});
I can’t figure out for the life of me why this doesn’t work. I’ve gotten the html function to work before, but for some reason this just leaves my autoNames tag empty… and i’ve called an alert() on the result variable and things exist in that string… any clues?
Thanks
When you pass a function to
.html()that function needs to return what you want it set to, like this:Currently you’re setting the
.html()but returningfalse, and that outer.html()call is setting it back to nothing. Alternatively, just do this since you’re dealing with one element: