简体   繁体   中英

Triggering javascript function from JSON

I've created an experimental typeface using p5js functions to create the letters. I'm hoping to use a News Feed API with the experimental typeface so that I can pull stories from the API and have them written in my typeface. I'm not exactly sure how to begin with this, as each individual letter requires a different function. Any ideas?

Try this:

function(json) {
  if(json.callbackFlag) {
    eval(data.callbackFunction);
  }
}

Here callBackFlag and callBackFunction has to be a property at JSON.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM