You need to sign in to do that
Don't have an account?
Anand Sengunthar
Hi All, I am trying to call apex from javascript. Wrote the below script
Hi All,
I am trying to call apex from javascript. Wrote the below script
<script src="/soap/ajax/15.0/connection.js" type="text/javascript">
</script> <script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
var r= confirm ("Are you sure you want to fetch?");
if(r== true)
{
var a = sforce.apex.execute("web","fetch",{ID: "{!Account.Id}"});
alert(a);
}
else
{
alert("Operation aborted");
}
I have already the class named 'web' with method 'fetch'. I wrote the above script on a button. When I click on that button, I get an error 'Unexpected token < '
On debugging , i found issue with the two lines defining the ajax connection and apex.js. can anyone help what is wrong with the code.
I am trying to call apex from javascript. Wrote the below script
<script src="/soap/ajax/15.0/connection.js" type="text/javascript">
</script> <script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
var r= confirm ("Are you sure you want to fetch?");
if(r== true)
{
var a = sforce.apex.execute("web","fetch",{ID: "{!Account.Id}"});
alert(a);
}
else
{
alert("Operation aborted");
}
I have already the class named 'web' with method 'fetch'. I wrote the above script on a button. When I click on that button, I get an error 'Unexpected token < '
On debugging , i found issue with the two lines defining the ajax connection and apex.js. can anyone help what is wrong with the code.
You have to define the ajax connection and apex.js in below format.
{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}
Thanks,
Benazir