0

I'm trying to save JSON database stored in Eventful API locally. I found this answer ,but how to use Blob() in my case?

There is one more answer but is for Java and i don't know how to use wget in javascript.

Thanks! :)

//Edit 1 I downloaded the file with

 wget 'http://api.eventful.com/json/events/search?c=music&app_key=API_KEY&page_number=1&date=Future&keywords=Andrea-Bocelli&callback=processJSONP' -O hi.json

//Edit 2 This answer not working for me

Community
  • 1
  • 1
Borislav Kostov
  • 68
  • 1
  • 10
  • var processJSONP = function(x){console.log(x);}; var s = document.createElement("script"); s.src = "URL"; document.body.appendChild(s); – Mike Ezzati Apr 26 '16 at 12:14
  • First defines the callback function, Then creates a dynamic script element and appends it to body. You have to replace "URL" with your link. As soon as script tag's content loaded, the callback function will be called. – Mike Ezzati Apr 26 '16 at 12:41

1 Answers1

-1

your link is JSONP , you could see processJSONP with a json parameter inside.

if you put this link in

<script src="http://api.eventful.com/json/events/search?c=music&app_key=your_key&page_number=1&date=Future&keywords=Andrea-Bocelli&callback=processJSONP">

then run it on browser you will get error, because this function is not defined yet.

so you need define a callback function then give a parameter,

function processJSONP(json){
     // using your json 
        console.log(json)
} 
Ma Yubo
  • 179
  • 9