Jump to content

jblevins1991

Members
  • Posts

    3
  • Joined

  • Last visited

jblevins1991's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I see what you mean i have edited this post to refute my previous statement. It says that the file returned a status of 200 and is shown in the network section of the console in chrome. since i know that it is at least getting a ready state of 4 and a status of 200 could it be how i am storing the data into the HTML page?
  2. i tried it without and placed async in there just to see if it would make a difference. what error console?
  3. I have an xml blog and a javascript file i am trying to use to publish this blog to a website with. I am just testing to see if AJAX is working at all because i have been having issues with this for a day now. Here is the Javascript code: function blog(){var xhr = new XMLHttpRequest(); xhr.onReadyStateChange = function(){if(xhr.readyState == 4 && xhr.status == 200){var xmldom = xhr.responseXML;alert(xmldom.documentElement);}} xhr.open("GET","blog.xml",true);xhr.send();} Here is the xml code: <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><item><title>hello</title> <link>www.google.com</link> <description>world</description></item><item><title>hello</title> <link>www.google.com</link> <description>world</description></item><item><title>hello</title> <link>www.google.com</link> <description>world</description></item></channel> </rss> Finally, here is the HTML code: <div id="blog"><h4>News Updates</h4><script type="text/javascript" src="blog.js" async></script><button type="button" onclick="blog()">click me</button></div> I have it set up to where the button in the HTML code has the onclick event listener that calls the javascript "blog()" function. the problem is that i never does anything NO MATTER WHAT I DO. it is always unresponsive. I never get a single alert box no matter what i make the script do inside the onreadystate function.
×
×
  • Create New...