Reputation: 907
Im making an ajax
call that looks like this:
$.ajax({
type:"GET",
dataType: "jsonp",
url:"https://api.twitter.com/1.1/users/show.json?user_id="+twitterId,
contentType:"application/json",
success:apiSuccessCallback,
error:apiFailCallback
});
and im including jsonp
as a workaround to cross-domain issues. However, I am getting the following errors:
Failed to load resource: the server responded with a status of 404 (Not Found)
AND
Failed to load resource: the server responded with a status of 400 (Bad Request)
If you're curious my success
is a simple alert statement and my error
is the same.
Anyone have any suggestions?
Upvotes: 2
Views: 672
Reputation: 1640
I would try including the suppress_response_codes
https://dev.twitter.com/docs/error-codes-responses
$.ajax({
type:"GET",
dataType: "jsonp",
data: {
suppress_response_codes: true
},
url:"https://api.twitter.com/1.1/users/show.json?user_id="+twitterId,
contentType:"application/json",
success:apiSuccessCallback,
error:apiFailCallback
});
From the documentation—
If this parameter is present, all responses will be returned with a 200 OK status code - even errors. This parameter exists to accommodate Flash and JavaScript applications running in browsers that intercept all non-200 responses.
Upvotes: 1