I am querying a database of latitude and longitude values and want to return the data in the form of objects. Each object should have a stName (state name) and stPoint(array of latitude and longitude points which should be pushed into the array for each record.) The entire object should then be pushed into the array stateObj.
There appears to be a syntax error in the code below:
var stateObj=[];
var stName;
var stPoints;
<cfoutput query="states" group="stateid">
var temp= Object.create{{stName:#states.stateid#},{ stPoints:[]}};
<cfoutput>var coordinates = new google.maps.LatLng(#states.latitude#, #states.longitude#);
stPoints.push(coordinates);
</cfoutput>
stateObj.push(temp);开发者_开发百科
</cfoutput>
You may want to check out ToScript()
and JSStringFormat()
in ColdFusion.
And use your basic debugging technique, like View Source.. and compare to what you expect.
精彩评论