jquery getJSON导致的页面阻塞

js中单点登录使用了如下代码:

getJSON("http://sso.jcloud.com/setCookie?t=sso.ehaoyao.com&callback=?");

由于某种原因,目标服务器停止了服务,导致请求超时,无法执行后续的js,直接导致页面不能加载

jQuery.getJSON( url [, data ] [, success( data, textStatus, jqXHR ) ] )
  • url
    Type: String
    A string containing the URL to which the request is sent.
  • data
    Type: PlainObject
    A plain object or string that is sent to the server with the request.
  • success( data, textStatus, jqXHR )
    Type: Function()
    A callback function that is executed if the request succeeds.

If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead.

By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.

getJSON默认是异步的,但是跨域时不支持异步,正是因为我的请求时跨域了的,所以同步请求时被阻塞了,因此出现页面不能加载。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值