I'm not sure what you mean by validating but I can tell you this:
JavaScript runs clientside, which means it does not have direct access to any serverside variables whatsoever, for that you need to write those variable values to the page and thereby setting a JavaScript variable.
What kind of validation do you need?
There are ways to communicate with the server using JavaScript, this has become known as AJAX but is basically different ways of requesting new information from the server without having to reload the whole page.