converting XMLHTTPRequest into $ajax

scabs2k9

New Member
I am fetching Google in a gadget using this code\[code\] <html><head><title>Browser</title></head><body onload= "getListCollection()" style="width:900px; height:900px;" ><div id="listAttributes" style="width:400px; height:400px;" ></div><script>function getListCollection() {var url = "https://www.google.co.uk" xmlhttp = new XMLHttpRequest();xmlhttp.open('GET',url,true, 'user', 'password');xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4); { document.getElementById("listAttributes").innerHTML = xmlhttp.responseText } }xmlhttp.send(null);}</script></body></html>\[/code\]I wonder how can i do the same thing using $ajax,I looked at different examples but dont know how they gonna fit in this situation, Plus if you can post some nice $ajax tutorials please,When I Change it to this, it doesn't work :(\[code\] <html><head><title>Browser</title></head><body onload= "getListCollection()" style="width:900px; height:900px;" ><div id="listAttributes" style="width:400px; height:400px;" ></div><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">$.ajax({ url : 'https://www.google.co.uk', type : 'GET', success : function(data){ $('#listAttributes').html(data); }});</script></body></html>\[/code\]Nothing comes up on the page, you knowCheers
 
Back
Top