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
Post a Comment