You need to sign in to do that
Don't have an account?
Access Denied while call salesforce pages using javascript ajax
<script type="text/javascript">
function loadXMLDoc()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","https://na7.salesforce.com/secur/frontdoor.jsp?sid=00DA0000000awHA!AQIAQAnIQGwxFcWZSZ2ptgH50O8NvMGdF4mfE2qCiCpO8nIiqeGdDobQkAZng1NvrwAl8YSd5FoIQYp.N.2_xsQjQhzhM4Z1&retURL=https://c.na7.visual.force.com/apex/apexpage",true);
xmlhttp.send();
}
</script>
well the above code returns error : Access Denied
I had already logged in using login.aspx page and it is working fine. but when I tried to call javascript function on the click event of button it is throwing error: Access Denied.
Can you help me on this regard.
-Anil
sid in the URL is the session id which changes with every login. So if you have hardcoded it in the JavaScript then that not going to work. In the case when you login from the Login page session is maintained and that is used, so that time no Access denied message is shown.