1

I am following the logic outlined in this example.

The code works when I run this in regular JavaScript. However, when placed in React, it doesn't.

stonktank:function myRun(json){
     document.getElementById('sting').innerHTML = json.Symbol;    

     var stockscript = document.createElement('script');
     stockscript.src = 'http://dev.markitondemand.com/MODApis/Api/v2/Quote/jsonp?symbol=AAPL&callback=myRun';
     document.getElementsByTagName('head')[0].appendChild(stockscript);    
},  

The error I get is myRun is not defined.

Community
  • 1
  • 1
Jason Chen
  • 2,487
  • 5
  • 25
  • 44
  • 1
    "myRun is not defined" means you need a global `myRun` function that can be called back. Shouldn't relate to React, but maybe strict mode? How are you defining `myRun`? You'd need it no matter what libraries you're using. – Jacob Aug 30 '16 at 16:44

0 Answers0