jQuery .load不断在Rails App中重新加载

时间:2013-07-29 21:54:02

标签: jquery ruby-on-rails ruby

我正在使用jQuery .load通过Ajax加载视图。出于某种原因,它不断向服务器发出请求。

$("#service_level").load("/charts/service_level", function() {
  return false;
});

这是正在加载的视图

<%= content_tag :div, "", id: "shipments-by-service-type", data: {shipments: @charts[:service_analysis][:spend_data]} %>
<script type="text/javascript">
  var dataArr, obj, prop;

  dataArr = [];
  obj = $("#shipments-by-service-type").data("shipments");
  for (prop in obj) {
    dataArr.push({
      label: prop,
      value: obj[prop]
    });
  }

  Morris.Donut({
    element: "shipments-by-service-type",
    data: dataArr,
    preUnits: '$'
  });

</script>

0 个答案:

没有答案