使用jQuery解析实时流HTTP分块传输JSON? [英] Parse live stream HTTP chunked transfer JSON with jQuery?

查看:214
本文介绍了使用jQuery解析实时流HTTP分块传输JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是实时HTTP流,它使用分块传输编码传递流JSON对象: http://stream.meetup .com/2/rsvps

Here is live HTTP stream that delivers streaming JSON objects using chunked transfer encoding: http://stream.meetup.com/2/rsvps

是否可以使用jQuery getJSON解析此JSON请求?我想获取每件商品,并在图片中插入新的图片标签.就像我在下面编写的函数一样,但不起作用

Is it possible to parse this JSON request using jQuery getJSON ? I want to get each item as it comes in and insert new image tag with the image. Like the function I wrote below, but doesn't work



$.getJSON("http://stream.meetup.com/2/rsvps", displayImages);

function displayImages(data) { $.each(data.results, function(i,item) {

function displayImages(data) { $.each(data.results, function(i,item) {

}

推荐答案

由于 JSONP 来解决此问题,但是Web服务需要支持它.

You cannot make cross-domain ajax requests due to the same origin policy. You can use JSONP to sidestep the problem, but the web service needs to support it.

它看起来像 Meetup API支持JSONP ,尽管JSONP自然不能处理流式更新.

It looks like the Meetup API supports JSONP, though naturally JSONP can't handle streaming-style updates.

这篇关于使用jQuery解析实时流HTTP分块传输JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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