【发布时间】:2016-05-03 10:35:57
【问题描述】:
我正在进行 ajax 调用以从视图文件中编写的函数中获取数据 来自视图文件的代码:
def adminRenderConceptGraph(request,group_id,node_id=None):
if request.is_ajax() and request.method == "POST":
group_name = u'home'
if node_id:
req_node = node_collection.one({'_id':ObjectId(node_id)})
template = 'ndf/graph_concept.html'
variable = RequestContext(request, {'node':req_node })
return render_to_response(template,variable)
其对应的url为:url(r'^graph/(?P<node_id>[^/]+)$', 'adminRenderConceptGraph', name='adminRenderConceptGraph'),
使用的ajax代码是:
$.ajax({
type: "POST",
url: "/home/ajax/graph/"+ atr,
data:{
group_id : '{{groupid}}',
node_id : atr
},
success: function(result) {
alert(result)
},
});
我收到 403 禁止错误。
【问题讨论】:
-
显示你的js代码。