0
这里我的情况如下.. 我已经div元素的列表包含patientid和鼠标的另一个信息在我们的计划,以显示另一个DIV总患者信息。怎么能在我的Ruby实现这一轨道上,请帮我...如何写一个jQuery的一个DIV鼠标悬停更新另一个DIV
这里我的情况如下.. 我已经div元素的列表包含patientid和鼠标的另一个信息在我们的计划,以显示另一个DIV总患者信息。怎么能在我的Ruby实现这一轨道上,请帮我...如何写一个jQuery的一个DIV鼠标悬停更新另一个DIV
您可以使用jQuery鼠标悬停事件发送Ajax请求轨道像
$(".some-div").mouseover(function() {
$.ajax({
data: {patientid: some_id},
url: "/your_controllers/your_action"
);
}
然后在你的控制器
class YourControllersController < ApplicationController
def your_action
@model = Model.find(params[:patientid])
respond_to do |format|
format.js
end
end
end
然后创建视图/ your_controllers/your_action.js.erb包含这样的代码
$(".expected-to-update-div").html(<%= @model.id %>);