i new jquery.
i have below line of code: need refer variable inside html () function.
$('#myform #formprogress').html('<img src="ajax-loader.gif" /> saving…'); now img src have in variable below.
var url = document.location.host; var url2 = url.concat("/myapp/public/images/ajax-loader.gif"); now inside need pass url2 img src tag. how can that?
thanks!
two ways:
$(...).html('<img src="' + url2 + '"/>saving...') or:
$(...).append($('<img/>').attr('src', url2)) the second method cleaner/better imho.
Comments
Post a Comment