how to call internal html from cakephp?

Using an API call, how can I get the data to show in HTML?

  • Let's say I make an API call and I get usernames and photos in JSON format.  How can I render the photos and usernames in HTML.  As an example, let's say with the data that's returned I get image url's that I can input into img src in an img tag and grab the username associated with it and show it next to an image.  How can I do that?

  • Answer:

    Do something like this <script type="text/javascript">var elem = document.createElement("img"); img.src = 'myImageSource.jpg'; document.getElementById("placehere").appendChild("elem");</script> Nowdays there are some libraries for making it easier (or sometimes more complicated) like jQuery.

Petr Chloupek at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.