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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:05:40+00:00 2026-05-24T19:05:40+00:00

Hello there!. I am trying to use a public api from wunderground (more info

  • 0

Hello there!.

I am trying to use a public api from wunderground (more info in [http://wiki.wunderground.com/index.php/API_-_XML][1]) on a web page (in fact in a widget for a phone, but for testing purposes, but is the same technically speaking and writing code).

The main question is that i haven’t been able to get the ajax request work, i try using a plain request (without any library) and request using jquery; as you can guess: no one works.

I am getting really frustrating with this. I know there is ton of info ajax, but unfortunately i only get more frustrating understanding less i doesn’t find one concrete answer over a sea of information (like the internet).

Maybe one charity soul 🙂 can help me, i copy paste the code: is to simple to only see and for test you only have to copy and paste.

Well that is all, thanks to all!.
Grettings.
Víc

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test Data</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
        <script type="text/javascript">
        function tryGet ()
        {
            try
            {
                var xhr = XMLHttpRequest ();
                xhr.open("GET","http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=SABE",true);
                xhr.onreadystatechange = function()
                {
                    if (xhr.readyState == 4) 
                    {
                        if (xhr.status == 200) 
                        {
                            alert(xhr);
                        }
                        else 
                        {
                            ret = "Error code " + xhr.status;
                            alert(ret);
                        }
                    }
                }
                xhr.send(null);
            }
            catch(e)
            {
                alert(e);
            }
        }

        function tryGet2 ()
        {
            //Let's fetch simple.xml using jQuery ajax request
            $.ajax(
            {
                type: "GET",
                url: "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=SABE", 
                dataType: "xml", 
                success: function(data, textStatus, jqXHR)
                {
                    alert(textStatus);
                }
            });
        }
        </script>
    </head>
    <body>
        <input type="button" value="try get" onclick="tryGet()"/><br/>
        <input type="button" value="try get 2" onclick="tryGet2()"/>
        <div id="content">
            <!-- To put things when things works fine-->
        </div>
    </body>
</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-05-24T19:05:41+00:00Added an answer on May 24, 2026 at 7:05 pm

    what you can do is

    1 create a server side proxy

    2 call the proxy through ajax and the proxy will in turn call the weather service

    3 get the xml response form the proxy

    4 parse it and display it

    here is how you do it in php

    create a file weather.php and put the following code in it

    <?php
    header('Access-Control-Allow-Origin: *');
    $url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=SABE";
    $str = file_get_contents($url);
    echo $str;
    ?>
    

    call weather.php from the client side like

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $.ajax({
        type:'GET',  
        url:'path/to/weather.php',  
        cache:false,
        dataType:'html',
        success:function(data){         
         xmlDoc = $.parseXML(data),
         $xml = $(xmlDoc),
         $credit = $xml.find('credit').text();
         alert($credit); // alerts Weather Underground NOAA Weather Station
        },
        error:function(jxhr,e){
            console.log(jxhr.status);
            console.log(e.responseText);
        }
    });
    
    });
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello people :) I'm trying to use strpos() to find whole words in a
I'm trying to use a System.Dynamic.ExpandoObject so I can dynamically create properties at runtime.
I see the following error in DDMS when trying to use a CheckBox on
I was trying to answer a regex question for someone and I came across
I'm trying to perform a simple Linq find first query on a typed DataTable,
Need a guide line .... I am trying to write a personal blog. What
I'm trying to upload some data to my App Engine datastore using the bulkuploader.
I am trying to select a specified text in TinyMCE editor using JavaScript in
I'm trying to get tipfy working on Google App Engine (GAE). I'm using Windows
I have the following class: /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute(System.Xml, 4.0.30319.1)] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute(code)] [System.Xml.Serialization.XmlTypeAttribute(Namespace=urn:eu.emsa.ssn)] public

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.