Pass Data from express to script tag after submit - Javascript JSon

Javascript examples for JSon:JSon Parse

Description

Pass Data from express to script tag after submit

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script id="histo-data" type="application/json">
    { "prop": "val" }

      </script> 
      <script type="text/javascript">
    var histo = JSON.parse(document.getElementById('histo-data').textContent);
    console.log(histo);

      </script>  
   </body>//from   w  w  w  .j a v a  2 s . c  om
</html>

Related Tutorials