Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble downloading & parsing Google Trends from a JSON file
    primarykey
    data
    text
    <p>I found this URL that gives you a google trends json file:</p> <p><a href="http://www.google.com/trends/fetchComponent?cid=TIMESERIES_GRAPH_0&amp;export=3&amp;q=javascript&amp;geo=US" rel="nofollow">http://www.google.com/trends/fetchComponent?cid=TIMESERIES_GRAPH_0&amp;export=3&amp;q=javascript&amp;geo=US</a> &lt;- This trends link shows you the US search trends history for the word javascript.</p> <p>I am having trouble parsing it and turning it into an object that I can use. Now I am starting to doubt it's even possible since it's not really an API but instead a raw file. </p> <p>I had a friend help me build a quick test but doesn't its not working either. </p> <p><strong>End Result Goal:</strong></p> <p>I just want to be able to pull in all the data via json, have javascript parse it and print the data in the console</p> <p>Here is the code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; var url = 'http://www.google.com/trends/fetchComponent?cid=TIMESERIES_GRAPH_0&amp;export=3&amp;q=bread&amp;cat&amp;geo=US'; var jsonObject; var google = { visualization : { Query : { setResponse: function(json) { jsonObject = json; } } } }; console.log('Making ajax request ...'); $.ajax({ dataType: 'text', url: url }) // When it arrives, pull out the JSON using the function we setup on // line 16 .done(function(data) { console.log('Data has arrived! Executing it to get the JSON from it ...'); eval(data); console.log(jsonObject); }) // If the request fails, print out the reason why. .fail(function(jqXHR, textStatus) { console.log("The ajax request failed: " + textStatus ); }); &lt;/script&gt; &lt;/body&gt; </code></pre> <p>Thank you!!!</p> <p>-Nico</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload