Ruby on Rails Wednesday, December 5, 2012

Hello guys,
I was wondering if I could display the ajax response in a modal
box. I could not find anything satisfying on the web. I am new to ajax.

This is what I was trying.

$(document).ready(function() {
var clicked1;
$(".inline").click(function(e) {
clicked1 = $(this).text();

$.ajax({
type: 'GET',
url:'/controller_path',
async: false,
data:{ foo1:clicked1
},
success:function(data){
$(".inline").colorbox({inline:true,
width:"35%",height:"200px"}).show();
}
});
});
});

And my div is hidden at the beginning.

<div class="inline" style="display:none;">

</div>

I want to display the controller response in the div and show it as a
modal box.

I am getting the response from controller but how do I put it into the
modal box? I am jus getting an empty modal view.



Nikhil

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment