2
I’m looking to use the Pure.js framework to create a post via json.
I found it on the Stack platform in English this topic, which is what I want to do, only that there’s a problem, I’m not being able to do the example of the second person who answered below.
Arturo Hernandez;
In your example, your HTML template should look like this:
<ul>
<li>
<img src="/img/pappo.gif" />
<h1>marte</h1>
<p><a href="http:://www.sito.it>guille</a></p>
</li>
</ul>
and a json likes it:
{
"mylist":{
"listone":
{"img" : "/img/pippo1.gif" ,
"text1" : "pluto1",
"text2" : "topolino1",
"link" : "http://www.sito1.it"
},
"listtwo":
{"img" : "/img/pippo2.gif" ,
"text1" : "pluto2",
"text2" : "topolino2",
"link" : "http://www.sito2.it"
}
}
}
and the end should be like this:
<ul>
<li>
<img src="/img/pippo1.gif" />
<h1>pluto1</h1>
<p><a href="http:://www.sito1.it>topolino1</a></p>
</li>
<li>
<img src="/img/pippo2.gif" />
<h1>pluto2</h1>
<p><a href="http:://www.sito2.it>topolino2</a></p>
</li>
</ul>
The first I get to do good, now that second of two, I don’t get.
What the javascript code would look like?
Could you do the example above in jsfiddle? , there is only the demo with the "name".
– user81560
Opa, sorry for the delay! Yes I can, today I provide you.
– Luan G. C. Rodrigues
@Matheuscalixto Follow the example in fiddle, it is very basic but it is possible to base on it, make a test increasing the amount of objects to see how it works. https://jsfiddle.net/tetbdkpe/
– Luan G. C. Rodrigues
Thanks Luan I’ll take a look;
– user81560