Jump to content


Photo

Please Help Before I Go Insane (With Myself Lol)


  • Please log in to reply
1 reply to this topic

#1 Jeremy

Jeremy

    Member

  • Member
  • PipPip
  • 36 posts
  • LocationNorth Yorkshire, United Kingdom

Posted 06 December 2013 - 10:32 PM

I have a very basic (as simple as you can possibly get) ajax script.

Problem is never seems to work when I type in, but when I compare line by line with the most basic example on the w3schools (again that works when I copy and paste, but I hate doing that, despise it personally with myself).

Works when I copied and pasted, then compared line by line mine to theirs, but it's just still not working makes no sense to me at all.

Could someone help me with this?

	function loadXMLDoc()
	{
		var xmlhttp;
		if(window.XMLHttpRequest)
		{
			xmlhttp=new XMLHttpRequest();
		}
		else 
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange=function()
		{
			alert(xmlhttp);
		}
	}

It's the w3schools one: http://www.w3schools...e=tryajax_first see when I copy up to where I have the alert, I change the w3schools example and it works, just baffling me to no end, what's wrong with what I am doing?

I'd really love to know.

Thanks in advance everyone :)

Jeremy.
  • 0

#2 Jeremy

Jeremy

    Member

  • Member
  • PipPip
  • 36 posts
  • LocationNorth Yorkshire, United Kingdom

Posted 06 December 2013 - 11:20 PM

Hmm not sure why this wasn't working but have got it now.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

★★★★★ 5 Star Rated Web Developer Course - check it out now!