Comments (6)
you have to use jsonp
. I do it too from localhost and it works.
from deprecated-dataapis.
I keep getting the "No 'Access-Control-Allow-Origin' header is present on the requested resource." error when I use jsonp and am using a local host. Is a different host/server required for access?
from deprecated-dataapis.
Can you add a snippet/gist of your ajax call?
from deprecated-dataapis.
I get the error when I run it from a local server (python and Atom.io http://atom.io/ app). Would that be the problem?
code begin:
// get ticker symbol
modApi.getTickerSymbol = function(name) {
var url = "http://dev.markitondemand.com/MODApis/Api/v2/Lookup/jsonp"
var request = {
input: name,
callback: "my_function"
}
return $.getJSON(url, request);
};
code end
Chris
On Jun 16, 2016, at 3:00 PM, Eric Nolte [email protected] wrote:
Can you add a snippet/gist of your ajax call?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub #23 (comment), or mute the thread https://github.com/notifications/unsubscribe/AHGx3AKJCWzmcBDXhwUhANMZrqYfLlSHks5qMZ01gaJpZM4Gcdf-.
from deprecated-dataapis.
To get you a quick answer, the problem appears to be getJSON not handling the request as a jsonp dataType.
According to jQuery's docs:
JSONP
If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details.
And the requested url using .getJSON looks like:
http://dev.markitondemand.com/MODApis/Api/v2/Lookup/jsonp?url=http%3A%2F%2F…is%2FApi%2Fv2%2FLookup%2Fjsonp&input=F&callback=my_function&dataType=jsonp
Which certainly looks like it should be handled as JSONP. However, in practice, it isn't. So I'd recommend just doing the longhand $.ajax call for now:
modApi.getTickerSymbol = function(name) {
var url = "http://dev.markitondemand.com/MODApis/Api/v2/Lookup/jsonp"
var request = {
url: url,
input: name,
callback: "my_function",
dataType: 'jsonp'
}
return $.ajax(request);
};
from deprecated-dataapis.
Thank you.
Chris Billiau
On Jun 16, 2016, at 3:21 PM, Eric Nolte [email protected] wrote:
To get you a quick answer, the problem appears to be getJSON not handling the request as a jsonp dataType.
According to jQuery's docs:
JSONP
If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details.
And the requested url using .getJSON looks like:
http://dev.markitondemand.com/MODApis/Api/v2/Lookup/jsonp?url=http%3A%2F%2F…is%2FApi%2Fv2%2FLookup%2Fjsonp&input=F&callback=my_function&dataType=jsonp
Which certainly looks like it should be handled as JSONP. However, in practice, it isn't. So I'd recommend just doing the longhand $.ajax call for now:
modApi.getTickerSymbol = function(name) {
var url = "http://dev.markitondemand.com/MODApis/Api/v2/Lookup/jsonp"
var request = {
url: url,
input: name,
callback: "my_function",
dataType: 'jsonp'
}
return $.ajax(request);
};
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
from deprecated-dataapis.
Related Issues (20)
- Some of your stocks are no longer working HOT 1
- Failure|APP_SPECIFIC_ERROR for Stock Quote API HOT 1
- Interactive Chart API does not return any elements HOT 4
- Interactive Chart API not returning Data for hour or minute requests. HOT 1
- Failed to load resource: net::ERR_CONNECTION_TIMED_OUT HOT 1
- Quote API returning Document Moved HTML instead of JSON response HOT 2
- adding 'Access-Control-Allow-Origin'?
- Error in data download from Markets Data API V1 - 1 HOT 1
- Error in data download from Markets Data API V1 - 2 HOT 1
- Error in data download from Markets Data API V1 - 3 HOT 1
- Error in data download from Markets Data API V1 - 4 HOT 1
- Error in data download from Markets Data API V1 - 5 HOT 1
- Zoom intervals HOT 1
- No way to get a quote for a specific day? HOT 1
- HTTPS fail HOT 1
- API page returns an error HOT 2
- Why return Quote results as a function? Why not return as JSON? HOT 2
- Is the API offline? HOT 1
- Failure|APP_SPECIFIC_ERROR HOT 1
- DEPRECATED HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deprecated-dataapis.