Hi,
I am fetching a set of data from the controller. The data set is in a cookie array. I have to display the set in a modal pop up. I am sending the request through an ajax call. How to display the array from the controller in the view in ajax in a modal box? I am using colorbox as my modal box.
.erb file:
$(document).ready(function() { var currentCellText;/*this variable will have the clicked cell value*/ $(".inline").click(function(e) { currentCellText = $(this).text();
$.ajax({ type: 'GET', url:'/leave', async: false, data:{ foo1:currentCellText }, success:function(data){ $.colorbox({html: <%= cookie[:event] %>, width:"35%",height:"400px"}); }, error:function(data){ alert("Failure"); } });
});
});
controller file:
cookie[:event] is having the data array.
If I print the cookie[:event] in the controller using a puts, I get the data set. But I am not able to achieve the same in the ajax modal box.
Regards, Nikhil