In my controller i m taking some records from table. I am trying to send records records to Js and show in my page.
@item_list = TransferDetail.find(:all) - Code to get data from table
The output of @item_list as
[{:source_id=>8, :object=>"11375810_0", :prefix=>"a",:unit=>"0", :description=>"xxxxx"}, {:source_id=>8, :object=>"11375810_1", :prefix=>"b", :unit=>"0", :description=>"yyyyy"}]
Sending records to JS side
WebView.execute_js("replaceItemList('#{@item_list}')")
In Js side
function replaceItemList(item_list){
alert (item_list);
}
Alert result as like this
[{:source_id=>8, :object=>"11375810_0", :prefix=>"a",:unit=>"0", :description=>"xxxxx"}, {:source_id=>8, :object=>"11375810_1", :prefix=>"b", :unit=>"0", :description=>"yyyyy"}]
Any one can suggest me to how can i show in my view page.
I know how to parse below and show in view page.
"{\"transferType\":\"D\", \"accountNumber\":\"132\", \"employeeId\":\"23\", \"orderedByPhone\":\"2423453453\", \"deliveryInstructions\":\"fdgfghvbn\"}"
Is possible to convert my @item_list value like this or Let me know some other suggestion