weixin_33693070 2016-05-03 11:25 采纳率: 0%
浏览 68

ajax django结果显示

I'm using following ajax code:

  $.ajax({
    type: "POST",
    url: "/home/ajax/graph/"+ atr,
    dataType: "html",
    data:{
      group_id : '{{groupid}}',
      csrfmiddlewaretoken: '{{ csrf_token }}',
      node_id : atr 
    },
    success: function(result) {
         $("#info").html(result);
    },
    complete: function(){   }
  });

the url and view are working properly. The data goes till the last template by the help of redirection from view file.

view code :

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) 

its corresponding url is:url(r'^graph/(?P<node_id>[^/]+)$', 'adminRenderConceptGraph', name='adminRenderConceptGraph'),

It's suppose to display a graph in the overlay. The data reaches the graph template in the overlay and this is the warning shown in the console. The screen just freezes.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

  • 写回答

1条回答 默认 最新

  • weixin_33688840 2016-05-03 12:00
    关注

    This could happen it you have a <script src="/somescript.js"></script> tag in yout template, that you are returning via AJAX (that is template ndf/graph_concept.html). More info at related question https://stackoverflow.com/a/28478146/3906845

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序