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 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配