json flash.now[:notice] flash.now[:alert]
#虚拟网络拓扑json数据
def topodata
#@vnic = Vnic.all
#flash.now[:notice] = ‘Message sent!‘
#flash.now[:alert] = ‘Message sent!‘
@vnic = {
nodes: [{ name: ‘bob‘, age: "22", awesome: "true" }, { name: ‘bob‘, age: 22, awesome:true }],
links: [{ name: ‘bob‘, age: "22", awesome: "true" }, { name: ‘bob‘, age: 22, awesome:true }]
}
flash.now[:alert] = @vnic
respond_to do |format|
format.html
format.json { render json: @vnic } #这里会自动调用to_json
end
end
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。