Hello,

I have a small code which needs to authenticate against a service and return me the key.
Following is the code, which works fine in IE8, the same is not working in Firefox(getting empty response).
Any help is highly appreciated.

if (window.XMLHttpRequest)
      {
      http=new XMLHttpRequest();
      }
    else
      {
      http=new ActiveXObject("Microsoft.XMLHTTP");
      }
if (http==null)
{
alert ("Browser does not support HTTP Request")
}
var params ="email=" + encodeURIComponent(email);
http.open('post',url,true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() 
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}else{alert(http.responseText);}
http.send(params);

You're missing a { at line 17, and a } before line 21.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.