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
on 2012-12-05 11:56
on 2012-12-06 11:53
Guys I figured it out.
$(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){
$.colorbox({html: ur_data_from_controller,
width:"35%",height:"400px"});
}
});
});
});
And you dont need that div.
Nikhil
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.