Javascript examples for Data Type:Variable Scope
Create/access global variable created on AJAX call
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w ww. j av a 2 s.c o m var ajax_response='var message="Hello World!";'; var sc=document.createElement('script'); sc.text=ajax_response; document.body.appendChild(sc); console.log(message); } </script> </head> <body> </body> </html>