javascript - Pass database variables to jQuery via element attribute? -


is there specification "pass database variables jquery via element attribute?"

i've been doing long time:

<script>    var status = <%= status %>; </script> 

i rather this:

<variable data-name="status" data-value="<%= status %>" /> 

then jquery:

var status = $('variable[data-name="status"]').attr("data-value"); 

i need element hidden displaying. know there pattern this, don't know it's called or how search it.

have tried:

<input type="hidden" data-name="status" data-value="<%= status %>" />


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -