Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to append json data to ul elements
Posted
Updated 13-Jul-16 1:50am
v2
Comments
Karthik_Mahalingam 17-Jun-16 4:01am    
post sample json data.
Sergey Alexandrovich Kryukov 17-Jun-16 4:13am    
Not clear. JSON is JavaScript, and HTML is HTML. (And, formally, appending HTML to HTML would produce non-HTML. You certainly mean something a bit more complicated, say, appending some HTML elements to the children of some other element.)

Probably you need to take JSON data and generate some HTML DOM using some rules and this data. If so, what's the problem? Do exactly that. Which part of JavaScript programming would be a problem for you here?

—SA

1 solution

Hi,
I created solution for you on codepen
A Pen by xszaboj[^]

I am not able to call you API from codepen. So a wrote you some comments where to call what.

Feel free to tweak it to your needs. Hope it will help you achive what you need to do. Any questions just ask, and i will try to help.
 
Share this answer
 
Comments
xszaboj 17-Jun-16 6:10am    
displayMessages('919985500220',data.messages);
You said in comment above, that you need to show messages by id, but you didn't said what id so I picked customernumber.
if(messageContainer.customernumber == id)
xszaboj 17-Jun-16 6:49am    
Yes, I can help, but how do you want it to work? Do you have multiple users on the page or only one?
xszaboj 17-Jun-16 7:51am    
sorry no idea how gmail chat looks like, I've never used it
xszaboj 17-Jun-16 8:00am    
check it now, if it is what you want
xszaboj 17-Jun-16 8:27am    
check the pen now.
http://codepen.io/xszaboj/pen/XKKQjE

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900