English 中文(简体)
JSON和Adhur Django——能够绕过同一来源的电击功能。
原标题:JSON and Python Django - can t get around same origin issue- callback function isn t called

我请我发言。

* E/CN.6/2009/1。 职能(数据)

并重犯错误:

错误 不是

If 我请我发言。a json file that is next to my html file it works fine. If 我请我发言。the google example url: http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=? it also works.

任何想法? 我认为,这可能与贾南戈有关,或我从我的服务器一侧的代码返回。

index(request):

    a = {}
    a[1320675940] = 1.8
    a[1320675941] = 2.8
    a[1320675942] = 38
    a[1320675943] = 4.8
    a[1320675944] = 5.8
    a[1320675945] = 6.8
    a[1320675946] = 7.8

    data = simplejson.dumps(a)

    return HttpResponse(data, mimetype="text/plain")
    #return HttpResponse(data, mimetype="json")
    #return HttpResponse(str(data), mimetype="text/plain")
最佳回答

你们正在回来(有简单的文字内容类型),而不是JSON-P。

你们需要看一下<代码>查询<>/编码>在该职能电话中显示和总结JSON的价值。

例如,<代码>?questback=foo:

foo(/* Your JSON here */);

您还应使用正确的内容类型(application/javascript)。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签