title: Ajax rss feed not working on localhost
body: <p>I'm trying to get the following code from w3schools to work oh my localhost through IIS. When I run it, I can see that it is trying to retrieve the requested rss feed but unfortunately it never executes. It only allows me to see the options to chose from but never displays them.</p>
  
  <p>Many thanks in advance for any help.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script&gt;
              function showRSS(str)
              {
                  if (str.length==0)
                    {
                    document.getElementById("rssOutput").innerHTML="";
                    return;
                    }
                  if (window.XMLHttpRequest)
                    {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                    }
                  else
                    {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                  xmlhttp.onreadystatechange=function()
                    {
                    if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
                      {
                      document.getElementById("rssOutput").innerHTML=xmlhttp.responseText;
                      }
                    }
              xmlhttp.open("GET","getrss.php?q="+str,true);
              xmlhttp.send();
          }
          &lt;/script&gt;
      &lt;/head&gt;
  &lt;body&gt;
  
      &lt;form&gt;
          &lt;select onchange="showRSS(this.value)"&gt;
              &lt;option value=""&gt;Select an RSS-feed:&lt;/option&gt;
              &lt;option value="Google"&gt;Google News&lt;/option&gt;
              &lt;option value="MSNBC"&gt;MSNBC News&lt;/option&gt;
          &lt;/select&gt;
      &lt;/form&gt;
      &lt;br&gt;
      &lt;div id="rssOutput"&gt;RSS-feed will be listed here...&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>And the php file</p>
  
  <pre><code>&lt;?php
      header('Access-Control-Allow-Origin: *');
      //get the q parameter from URL
      $q=$_GET["q"];
  
      //find out which feed was selected
      if($q=="Google")
            {
            $xml=("http://news.google.com/news?ned=us&amp;topic=h&amp;output=rss");
            }
          elseif($q=="MSNBC")
            {
        $xml=("http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml");
        }
  
      $xmlDoc = new DOMDocument();
      $xmlDoc-&gt;load($xml);
  
      //get elements from "&lt;channel&gt;"
      $channel=$xmlDoc-&gt;getElementsByTagName('channel')-&gt;item(0);
      $channel_title = $channel-&gt;getElementsByTagName('title')
      -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
      $channel_link = $channel-&gt;getElementsByTagName('link')
      -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
      $channel_desc = $channel-&gt;getElementsByTagName('description')
      -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
  
      //output elements from "&lt;channel&gt;"
      echo("&lt;p&gt;&lt;a href='" . $channel_link
        . "'&gt;" . $channel_title . "&lt;/a&gt;");
      echo("&lt;br&gt;");
      echo($channel_desc . "&lt;/p&gt;");
  
      //get and output "&lt;item&gt;" elements
      $x=$xmlDoc-&gt;getElementsByTagName('item');
      for ($i=0; $i&lt;=2; $i++)
        {
        $item_title=$x-&gt;item($i)-&gt;getElementsByTagName('title')
        -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
        $item_link=$x-&gt;item($i)-&gt;getElementsByTagName('link')
        -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
        $item_desc=$x-&gt;item($i)-&gt;getElementsByTagName('description')
        -&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue;
  
        echo ("&lt;p&gt;&lt;a href='" . $item_link
        . "'&gt;" . $item_title . "&lt;/a&gt;");
        echo ("&lt;br&gt;");
        echo ($item_desc . "&lt;/p&gt;");
        }
  ?&gt; 
  </code></pre>