my webservice in nodejs returns the Json array to client ejs file using res.render("clientejs file",array).How can i access that array on client side?
There are at least a couple of ways to do this.
One easy way is to just reply to the request with JSON, that you then access via XHR. This doesn't require a template as you can just do: res.json(array);. Then you just send an XHR to that route and parse the response (if you're using jquery, you can have it parse the JSON response for you).
Another way is to insert the literal array contents into javascript in your template. Example:
code:
res.render('mytemplate', { data: JSON.stringify(array) });
mytemplate.ejs:
<html>
<head>
<script>
var data = <%- data %>;
console.dir(data);
</script>
</head>
<body>
</body>
</html>