ActiveVFP: How do I pass a foxpro variable into a Javascript variable i.e cName from the *.AVFP file?

Topics: Developer Forum, Project Management Forum, User Forum
Feb 24 at 4:50 PM
ActiveVFP: How do I pass a foxpro variable into a Javascript variable i.e cName below?
<% cName='GauldinMaurice'
use member in 0
if SEEK(lcName,'Member','name')
cName=ALLTRIM(Member.Name)
%>
<script>
    alert(cName+" is a Member.");
</script>
<% else %>
<script>
    alert(cName+" is not a Member.");
</script>
<% endif %>
Coordinator
Mar 31 at 9:45 PM
Put the parameter like this:

alert("<%=lcName%> is a Member.");

The lcName is replaced in the HTML before sending so it can be inside quotes or inside HTML comments.

Personally I've changed all my site to AJAX and strictly avoid VFP in the HTML because if there's a syntax error you will never find it.