获得Twitter的/用户/显示/返回错误:400错误:404(AJAX) [英] GET on Twitter's /user/show/ returning Error:400 and Error:404 (AJAX)

查看:183
本文介绍了获得Twitter的/用户/显示/返回错误:400错误:404(AJAX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林作出 AJAX 调用是这样的:

$.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
});

和IM,包括 JSONP 作为一种解决方法,以跨域问题。不过,我收到以下错误:

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)

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.

任何人有什么建议?

推荐答案

我会尝试,包括燮press_response_ codeS https://dev.twitter.com/docs/error-$c$cs-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—

如果该参数为present,所有响应将与返回的   200 OK状态code - 甚至是错误的。该参数的存在是为了适应   在浏览器中运行的拦截Flash和JavaScript应用程序   所有非200响应

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.

这篇关于获得Twitter的/用户/显示/返回错误:400错误:404(AJAX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆