Ok the site is score oid and i need to get some information about a game. the server returns data in xml format.

I have tried many different code but cant get it to return anything successfully.

OK here is the code im using (for security reasons i have changed the correct key values, you could test the script with your existing php etc..)

Code:
function getgame()
{

var url ="http://www.scoreoid.com/api/getGame";
var request;

var params ='api_key: "b9d57f3fbf2faa8d607ad2fc6178ab153gt08b48", game_id: "k4scvJUW2", response:"XML"';

request = new XMLHttpRequest();

request.open("get",url,1);

request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

request.setRequestHeader("Content-Length", params.length); // POST request MUST have a Content-Length header (as per HTTP/1.1)	
		
request.onreadystatechange = function()
            {
                if (request.readyState === 4) 
				 {
                 if (request.status === 200 ) 
				  {
                  alert(request.responseText);//getAllResponseHeaders());
                  }
                 else 
				  {
                  alert("ERROR");
                  };
                 };
            };
		request.send(params);

}
it should return a xml data structure with the info i need.

The API getGame on the server needs three variables posted api_key, game_id and response


any help appreciated. and please i have given it a lot of tries, im new to javascript



for testing purposes i made a html file with the function to see if the javascript works:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  


<script type="text/javascript">  
function getgame()
{

var url ="http://www.scoreoid.com/api/getGame";
var request;

var params ='api_key: "b9d57f3fbf2faa8d607ad2fc6178ab153cc08b48", game_id: "k4scvKUW3", response:"XML"';

request = new XMLHttpRequest();

request.open("get",url,1);

request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.setRequestHeader("Content-Length", params.length); // POST request MUST have a Content-Length header (as per HTTP/1.1)	
		
request.onreadystatechange = function()
            {
                if (request.readyState === 4) 
				 {
                 if (request.status === 200 ) 
				  {
                  alert(request.responseText);//getAllResponseHeaders());
                    //this.data = request.responseText;
                  }
                 else 
				  {
                  alert("ERROR");
                  };
                 };
            };
		request.send(params);

}
    </script> 
	
	 
    </head>  
<body>
<button onclick='getgame();'>PRESS</button>
</body>
</html>