Porl123 Posted April 7, 2010 Share Posted April 7, 2010 function ajaxCon() { var xmlhttp = false; if(window.XMLHttpRequest) { xmlhttp = XMLHttpRequest; } else { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } if(xmlhttp != 'false') { return xmlhttp; } } var xmlContent = ajaxCon(); if(xmlContent == false) { alert('Bad browser.'); } else { xmlContent.open('GET', 'http://www.google.com', true); xmlContent.send(); xmlContent.onreadystatechange = function() { if(xmlContent.readyState == 4) { alert(xmlContent.responseText); } } } Hi, I'm quite new to javascript/ajax and I'm not really sure why this isn't working. I just copied this from a few tutorials and edited it. What I want it to do is to get the contents of the page. I've just put in google as an example. Can anyone see where I've gone wrong? Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.