V
V
Vyacheslav2015-10-15 20:50:37
JavaScript
Vyacheslav, 2015-10-15 20:50:37

Insert image into jquery template via json?

Hi all!
The essence of the problem:
I have a json that contains text in which < img src = "..." / > occurs in the text - emoticons, in short,
emoticons in the text are parsed through PHP in the text. Those. PHP catches by text :-) :-D etc and converts them to < img src="..." / >
json flies to the page when the feed is loaded
, the problem is that after I processed json through jquery templates, instead of images, I get text something like: "< img src="image.gif" width="16" height="16" alt=":-)" style="border:0; " / > Stimulating the community, as follows from the above"
i.e. instead of converting it to an image,
json arrives correct, the quotes are correct, everything is as it should be, but it refuses to be converted into a picture.
Why? and how to win? tell me plz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-10-15
@Deonisius

Purely intuitive - you use the .text() method , not .html()
PS Or special. characters converted to mnemonics

'&ltimg src=&quot;image.jpg&quot; alt=&quot;&quot; &gt;'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question