簡體   English   中英

如何使用數組結果在軌道上渲染json ruby

[英]How Render json ruby on rails with array result

有:

def render
  begin
    array= [:orange => 1,:limon => 3]
  rescue Exception => e
    puts e
  end
end

如何在一個json中返回數組

def render
  begin
     array= [:orange => 1,:limon => 3]
     render :json => {:array => array},:callback => params[:callback]
  rescue Exception => e
     puts e
  end
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM