【发布时间】:2013-03-28 01:08:52
【问题描述】:
如果我有一个像 <a href="/account/user">Get User Data</a> 这样指向我自己服务器内的 view 的链接,有没有办法将 json 对象(也许只是用 ajax?)发送到另一个外部服务器并检索答案?像这样的:
from django.shortcuts import render
def profile(request):
#send a json object to another server like http://www.myotherserver.com/user
#get the answer and process it
return render(request, 'accounts/profile.html' ,
{'profile_user': data_from_the_external_server})
上面我当然可以用 jquery-ajax 来实现它,但我只是想知道我是否可以这样做......
提前致谢。
【问题讨论】:
标签: ajax django json django-views query-string