Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

html vs json

[ Edited ]

which would be the correct way to assemble a list of pictures and some additional data?

 

1 - generating html with a script. Php, ajax and search for it using document.getElementById ("result"). innerHTML = data_result;.

 

2- Generate a Json  with  php script and fetch the info using ajax,  generate the html with with javascript, bearing in mind that the process if full of logic

 html+=' <div class="title"  x-blackberry-focusable="true"  ><div style="float:left;margin-top:5px;">'+x+'</div></div>';

 html+=' <div class="content"  id="'+x+'" style="display:block">'; 

 for(y in result[x]){

 html +=' <div  x-blackberry-focusable="true" onclick="next('+result[x][y][0]+')" ><div  ><img src="'+result[x][y][1]+'" /></div><div   class="next"></div></div> ';

 }

 html+= '</div>';

}

html +="</div>"

document.getElementById("result").innerHTML =html;

Contributor
Posts: 25
Registered: ‎11-10-2010
My Device: Not Specified

Re: html vs json

How about using json response in HTML 5 ? It should be less pain compare to all the process.