0

I'm new to web development and I'm using AppWebServer to AppWeb to host my website. AppWeb provides ESP (Embedded Server Pages) that is used to create web applications. You may embed a C code.

Now my problem is. I have a javascript code and a C Code, I need to access a variable from the C code and use it in javascript, the question is how do I do that?

I am thinking that even if I declare the variable as global, I wont still be able to access.

3
  • Is the javascript executed in the client or on the server? Commented Nov 7, 2013 at 9:32
  • @KlasLindback in the server. Commented Nov 7, 2013 at 9:38
  • 2
    Maybe start by reading the documentation? Section about modules seems promising: appwebserver.org/products/appweb/doc-4/guide/appweb/programmers/… Commented Nov 7, 2013 at 9:52

1 Answer 1

1

You can create a hidden input type using HTML and insert the variable you want with something like <input type="hidden" id="something" value <%=function in c that returns your variable%>" /> and then access it with your JavaScript using getElementById("something")

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.