html - dynamically update google trends embedded script from javascript -


i want use embedded google trends widget in website. want, able select word drop down menu, , show google trends chart of word.

to able add widget, tried use script tag, cannot update dynamically, after full refresh of page.

please advise. thanks

i'm using in html file:

<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/1087_rc03/embed_loader.js">                                 </script>                                 <script type="text/javascript" id="reloadscript">                                     state.init([]);                                     trends.embed.renderexplorewidget("timeseries", {"comparisonitem":[{"keyword": state.active_symbol(),"geo":"","time":"today 1-m"}],"category":0,"property":""}, {"explorequery":"date=today 1-m&q=state.active_symbol()","guestpath":"https://trends.google.com:443/trends/embed/"});                                 </script> 

and in javascript file:

var state = state || (function(){ var activesymbol = localstorage.getitem('activesymbol');     var _args = {}; // private     return {         init : function(args) {             _args = args;             // other initialising         },         active_symbol : function() {             return activesymbol;         }     }; }()); 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -