Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HitMaker

macrumors newbie
Original poster
Mar 7, 2010
4
0
Hi there, I am struggling with a simple xml http request :eek: and there is no way I can make it work :(

Its simple, I have this URL Request:

http://localhost/elgi/html/pg/api/rest/xml?method=login&username=luis83rs&password=28012009

Which gives 0 if it's correct and -1 if is not.

But I don't know how to implement it.

I am developing a client application which will connect to a website, based on ELGG, and I am with the login form... So when I click to Submit button the event function onClick manages the username and password entered.

I have tried the library sample code it comes but is doesn't seem to work :(

Code:
var userField = document.getElementById("nameField");
var passField = document.getElementById("passField");

// Values you provide
var feedURL = "http://localhost/elgi/html/pg/api/rest/xml?method=login&username=" + userField.value + "&password=" + passField.value;

                        // The feed to fetch
var onloadHandler = function() { xmlLoaded(xmlRequest); };    // The function to call when the feed is loaded; currently calls the XMLHttpRequest load snippet

// XMLHttpRequest setup code
var xmlRequest = new XMLHttpRequest();
xmlRequest.onload = onloadHandler;
xmlRequest.open("GET", feedURL);
xmlRequest.setRequestHeader("Cache-Control", "no-cache");
xmlRequest.send(null);

But nothing happens :(

I am a newbie I know, but I don't know what else to do :(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.