I evaluate two options for accessing data on the server side on the client side. Confuse a little about efficiency, or maybe you can call it as the best approach for this.
I need to access data on the server side, maybe an integer value in javascript on the client side. I know about two options.
Create a public variable or property on the server side and set the client-side javascript variable for it, as shown below:
var value = eval(<% =value %>);
Create a hidden asp variable and set the value in this hidden variable on the server side and access it through javascript using document.getElementById ().
What is the best approach and what are the pros and cons?
source
share