How to add variety of elements to a jQuery plugin? XML or parameters?



I'm wondering how people should add elements to a jQuery plugin. It's because you are able to add multiple images which have a description, multiple links and so on. For this kinda structure a XML seems optimal but I'm not sure if that's the way to go with JS or a jQuery plugin.


What is the best practice / your suggestions?


Best Regards


Edit: Example what I mean:


I could parse an .xml File with the Structure of



<element>
<src></src>
<descr></descr>
<link1></link1>
<link2><link2>
</element>
<element>
<src></src>
<descr></descr>
<link1></link1>
<link2><link2>
</element>
. . .


or JSON like



or use for example $('div').callMyPlugin({
"element": {
"src": "...",
"descr" : "...",
"link1" : "...",
"link2" : "...
},
"element": {
"src": "...",
"descr" : "...",
"link1" : "...",
"link2" : "...
});

No comments:

Post a Comment