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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:19+00:00 2026-06-16T00:41:19+00:00

How to bind json value to script and need a output in html. I

  • 0

How to bind json value to script and need a output in html. I try to get the data and image of weather, but no solution. Help me

here is an sample of jquery

$(function(){
   $.getJSON("http://query.yahooapis.com/v1/public/yql", {
      q: "select * from json where url=\"http://api.wunderground.com/api/91bbc8aab3ab1f34/geolookup/conditions/q/IN/Chennai.json\"",
      format: "json"
}, function(data) {
   var $content = $("#content")
   if (data.query.results) {
     $content.text(JSON.stringify(data.query.results));
   } else {
      $content.text('no such code: ' + code);
   }

 });
});​

code in html

<script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>

the content is div and icon is an image tag

<div id="content">
<img id="weather_icon" />

when i run the application it takes the data alone . i need the weather images and data from the api.
Please help

  • 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-16T00:41:19+00:00Added an answer on June 16, 2026 at 12:41 am

    Try this, was able to display the weather icon.. I modified the jQuery to display the image by setting the url into the image tag. Just dig for the data you want to be displayed in the content div.

            $(function(){
            $.getJSON("http://query.yahooapis.com/v1/public/yql", {
                q: "select * from json where url=\"http://api.wunderground.com/api/91bbc8aab3ab1f34/geolookup/conditions/q/IN/Chennai.json\"",
                format: "json"
                }, 
                function(data) {
                    // Dig for the data from the JSON object. 
                    //  The image URL can be found at: query > results > json > current_location > icon_url
                    $('#weather_icon').attr('src', data.query.results.json.current_observation.icon_url);
                    //  Do the same for any data you want displayed for the content to be displayed..
                });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to bind a JSON object to a HTML element. e.g. I have
I'm attempting to data bind JSON data return from a Grails controller to a
I'm trying to bind a simple json object (just key value pairs) to an
I am trying to bind data from json. In the controller, I am sending
I am trying to bind a model coming from the server over json to
My code is not working: package com.foo.json; import javax.xml.bind.annotation.XmlRootElement; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; @XmlRootElement
Is BIND DNS + DLZ reliable? scalable? Is it a better solution than writing
I bind keyDown , keyPress and keyUp events to a text input. I need
I have a jQuery ajax function that retrieves JSON data. In the success block
I have a function that makes an ajax call to get the initial data

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.