function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
billgreenhawbillgreenhaw 

Problem passing parameter to apex.execute in javascript

Hi,

I am trying to pass a parameter to sforce.apex.execute.  If I use a static value it works fine.  But I am trying to pass a javascript variable as the parameter. 

In the code below it is named location.  I then use  {address:location} but it does not pass the variable.  When I view the HTML source it has {address:location} not {address:what the location should be}

Any help is greatly appreciated.

Code:
<html>
<head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/12.0/connection.js"></script>
<script src="/soap/ajax/12.0/apex.js"></script>
<script>
sforce.debug.trace=true;

function testApex() {
alert("Start");

var location = "{!Account.BillingStreet}, {!Account.BillingCity} {!Account.BillingState}";
alert(location);
var result = sforce.apex.execute("XmlStreamReaderDemo", "XmlStreamReaderD", {address:location});
alert(result);

}

</script>

</head>
<body onload=testApex();>