1

The example I am working with can be found on this link.

My JSONP content looks like so:

myRun ( { "Status": "SUCCESS", "Name": "Apple Inc", "Symbol": "AAPL", "LastPrice": 106.82, "Open": 106.62 } ) 

The code I am using below does not work. And I am not sure how to reorganize it to use JSONP.

var selfish = this; $.getJSON('http://dev.markitondemand.com/MODApis/Api/v2/Quote/jsonp?symbol=AAPL&callback=myRun', function(data){ console.log(selfish.data.Symbol); }); 
1
  • 1
    read the docs for getJSON specifically how to make it JSONP - hint, you need something like somecallback=? as a search string in the URL ... the ? being literally a ? and somecallback depends on the API you are calling Commented Aug 30, 2016 at 2:30

1 Answer 1

1
 $.ajax({ url: "url", dataType: 'JSONP', jsonpCallback: 'callback', type: 'GET', success: function (data) { if (data.error) { console.log ("data error:", data.error.errorMessage); } }, error: function (data) { console.log ("ajax connection error:"); } }); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.