I am building a rss feed reader for my website , my goal is to display news headlines. I followed this tutorial(https://www.w3schools.com/php/php_ajax_rss_reader.asp). The code displays the rss feeds perfectly, but there is unwanted functionality; e.g:The user has to choose a feed from a select list before the feed will display. I want to keep the option to choose different feeds from the form but I would like the feed to display automatically without the need for the user to make a choice. Any help is greatly appreciated, Thanks
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"></sxript>
<script>
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 (this.readyState==4 && this.status==200) {
document.getElementById("rssOutput").innerHTML=this.responseText;
}
}
<!-- begin snippet: js hide: false console: true babel: false -->
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
<form>
<div class="form-group">
<label>Select a News Feed</label>
<select class="form-control" onchange="showRSS(this.value)">
<option value="">Select an RSS-feed:</option>
<option value="One America News">One America News</option>
<option value="NBC">NBC News</option>
</select>
</form>
</div>