Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:53:20+00:00 2026-06-17T05:53:20+00:00

I have read a few examples here however I am still a little stuck.

  • 0

I have read a few examples here however I am still a little stuck.
I and getting a feed from an api that is formatted something like this

{
total:123,
id: "1234",
results: [
           {
           id: "1234",
           name: "bobs market",
           phone: "123-456-7890",
           othervalue: "33333333",
           onemore: "get this"
           },
           {
           id: "1235",
           name: "jans market",
           phone: "123-456-7899",
           othervalue: "33333353",
           onemore: "get this one"
           }
         ]
}

I am trying to use the $.getJSON feature to loop through each record and display each business inside a div with the id of #bizresults so the resulting html would look something like this

<div id="business">
      <h4><a href=#>Business Name</a></h4>
      <p id="phone">555-555-5555</p>
      <p id="adr">
      <span id="street-address">12 Main Street</span>
      <span id="locality">Sacramento</span>
      <span id="region">CA</span>
</div>

I seem to get the results in the script i can see them in the Chrome dev console however I cant seem to get the output to my div.

Taking the suggestion I looked @ Handlebars.js ** I am still just not quite there —

<script id="biz_template" type="text/x-handlebars-template">

    <div id="businesses">
    {{#each jsonResult}}
    <a href=#><h4>{{name}}</a></h4>
    <p id="phone">{{phone}}</p>
    <p id="adr">
    <span id="street-address">{{address}}</span>
    <span id="locality">{{city}}</span>
    <span id="region">{{state}}</span>
    </p>
    {{/each}}
    </div>

  </script>




<script>
       var source = $("#biz_template").html();
       var template = Handlebars.compile(source);

var data = '{"totalCount":61,"impId":"17","jsonResult":[{"impId":"17","listingId":"94523","pageUrl":"/page/LA/new-orleans/ccs-coffee-house/17-94523.html","name":"CC's Coffee House","phone":"(504) 586-0278","address":"650 Poydras St","city":"New Orleans","state":"LA","latitude":"29.949339","longitude":"-90.070017"},{"impId":"17","listingId":"417428","pageUrl":"/page/LA/metairie/ccs-community-coffee-house/17-417428.html","name":"CC's Community Coffee House","phone":"(504) 831-1449","address":"701 Metairie Rd","city":"Metairie","state":"LA","latitude":"29.98763","longitude":"-90.130528"},{"impId":"17","listingId":"228835","pageUrl":"/page/LA/new-orleans/ccs-community-coffee-house/17-228835.html","name":"Cc's Community Coffee House","phone":"(504) 566-1863","address":"228 St Charles Av","city":"New Orleans","state":"LA","latitude":"29.951952","longitude":"-90.069885"}]}';

$("#biz").html(template(data));
 </script>

Any thoughts?

I do have div with the id of biz in the HTML

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:53:21+00:00Added an answer on June 17, 2026 at 5:53 am

    I just did a plugin with $.getJSON and handlebars, this is just parts of it and basically all you need. I can post the whole plugin if you want to.

    dont forget to reference the file or url to handlebars

    <script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js" type="text/javascript"></script>
    
    var container = $('#tweets'),
        template: $('#tweets-template').html()
    
    $.getJSON(this.url, function(data) {
                        var tweets = $.map(data.results, function(tweet) {
                            return {
                                author: tweet.from_user,
                                tweet: tweet.text,
                                thumb: tweet.profile_image_url,
                                url: 'http://twitter.com/' + tweet.from_user + '/status/' + tweet.id_str
                            };
                        });
    
                        var templateHandlebars = Handlebars.compile(template);
                        container.append(templateHandlebars(tweets));
    });
    
    
    //this is the html and the template
    <ul id="tweets">
            <script id="tweets-template" type="text/x-handlebars-template">
                {{#each this}}
                    <li>
                        <img src={{thumb}} alt={{author}} />
                        <p><a href={{url}}>{{tweet}}</a></p>
                    </li>
                {{/each}}
            </script>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read few articles about table partioning but still I am bit confused
I have read quite a few selcet+update questions in here but cannot understand how
I've read a few posts on this but I'm still confused. I have this
I have a few cvs files from which I want to read specific lines
Although I have read a few previously answered questions regarding a similar issue, I
I need to create an excel file via C#. I have read a few
I'm fairly new to working with relational databases, but have read a few books
I've read a few good posts on automating build processes, however, what I'm interested
I have a few simple (hopefully) questions that I have been unable to find
I am trying to input text from Android into websites, and I read that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.