You need to sign in to do that
Don't have an account?
Login Error through Ajax Toolkit
<apex:page >
<html>
<head>
<title> Ajax ToolKit </title>
<script src="/soap/ajax/22.0/connection.js" type="text/javascript"></script>
<script language="JavaScript">
function check()
{
try{
var result = sforce.connection.login("a@abc.com", "password");
alert("result");
alert("you are loged in");
log("logged in with session id " + result.sessionId);
}
catch(error) {
alert("Wrong user name and password");
if (error.faultcode.indexOf("INVALID_LOGIN") != -1) {
// alert(error);
sforce.debug.log("check your username and passwd, invalid login");
} else {
sforce.debug.log(error);
}
}
}
</script>
</head>
<body>
<apex:form >
<apex:commandButton onclick="check();" value="Click"/>
</apex:form>
</body>
</html>
</apex:page>
// When I run this code it wil not respond me correctly either i entered correct credentials in mentioned red line above.
It took me at the alert message " Wrone Username and Password"
Please help me. If there is any error in my code let me.
Had u Alerted the error in catch:
I think Log is not defined here.. Instead of using log, alert it:
Hope it helps
Hi,
I Tried the above code using the correct credentials, but ir displayed an alert message (Wrong username and password).
An Ajax tool kit Shell has poppedup allowing us to enter some text.. what is it used for.
Thanks,
Venkat