In success of ajax return, on the success state, I run this append:
$('hello').append('
<div class="row" style="background-image: url("/page/12/image-' + user[i]['id'] + '"); height: 155px;" ></div>')
I have couple of more lines, and everything works fine. However, on this line, for some reason this line is getting created in my view:source
as:
<div class="row" style="background-image: url(" profile page 12 image 1.png") height: 155px"></div>
And the image doesn't get created because it has deleted the forward slashes ('/') while appending.
You have just nested your quotes wrong, forgetting to escape the innermost single quotes.
I stepped through your example and got this to work
HTML:
Js (included jQuery 1.8.3):
Issue appear to be mixing double and single quotes within string . Try adding
id
#
orclass
.
selector beforehello
This way it will work: