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 8983977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:58:35+00:00 2026-06-15T20:58:35+00:00

I am receiving content from a JSON call and I would like to populate

  • 0

I am receiving content from a JSON call and I would like to populate 3 object that returned with response in news_item class as follows:

<div class="news"> 
        <div class="news_item" style="margin-left: 0 !important;">

        <div class="ni_image">
            <a href="/HaberDetay/TITLE/ID"><img src="IMAGE"width="203" height="109"/></a>
        </div>
        <div class="ni_text">
            <div class="ni_text_title">TITLE</div>
            <div class="ni_text_content"> 
                CONTENT
            </div>
        </div>
        </div> 
</div>

I am able to receive the data as follows. but not quite sure how to populate the news_item div as above. I also need to clear, news and replace everything with data from JSON response.

var newsByCity = JSON.parse(msg);

                $.each(newsByCity, function (key, item) {
                    alert("Code: " + item.City + " ,Name: " + item.Title + " ,Country: " + item.County);

                });

any pointers? how can i do this?

EDIT: i m getting back TITLE, ID, CONTENT etc. I just need to see how i can create this new divs.

  • 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-15T20:58:36+00:00Added an answer on June 15, 2026 at 8:58 pm

    Mind you jQuery templating is still in beta (can be DL here: https://github.com/jquery/jquery-tmpl)

    Create a jQuery template of this HTML, with the Title/ID/Content etc where they will be appearing ${TITLE}/etc. Basically like this:

    <div class="news_item" style="margin-left: 0 !important;">
        <div class="ni_image">
            <a href="/HaberDetay/${TITLE}/${ID}"><img src="IMAGE"width="203" height="109"/></a>
        </div>
        <div class="ni_text">
            <div class="ni_text_title">${TITLE}</div>
            <div class="ni_text_content"> 
                ${CONTENT}
            </div>
        </div>
    </div> 
    

    Then just create the template and append it to news.

    $('#yourTemplateScriptArea').tmpl(newsByCity).appendTo('.news');

    Here’s an intro on Templating if you’ve never done it before.
    http://stephenwalther.com/archive/2010/11/30/an-introduction-to-jquery-templates.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div that is receiving content from an ajax call. Right now
I'm receiving some 'body' content from a jquery's json call, where I can get
My web service is receiving xml from a third party that looks like this:
I am receiving a JSON response from our server and it is compressed using
I'm struggling getting the JSON string that was sent from a web page to
I am receiving JSON Data from a client application, but once in a while
Am receiving null from json post using jquery. see my code below in order.
I'm using JSON to receive content from a Wordpress website and display it on
I'm receiving this fatal error message: Using $this when not in object context. This
My problem is html content not being parsed with JSON.parse . I am getting

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.