[英]Show remote content in modal bootstrap
Currently I am facing one issue that is failed to show remote content to modal dialog (bootstrap). 目前,我面临的一个问题是无法将远程内容显示到模式对话框(引导程序)。 Is it possible to append response content to modal content ? 是否可以将响应内容附加到模态内容?
Sample of index.jsp index.jsp示例
<form id="cusPayment" name="cusPayment" method="post" action="CusConfirmPayment.jsp" >
<input id="lflag" name="lflag" type="hidden" value="E">
<a data-toggle="modal" data-remote="CusConfirmPayment.jsp" href="#" data-target="#myModal" id='paynow322' class="btn btn-primary btn-large">Load External Page</a>
</form>
<!-- Modal --> //show the remote content
<div class="modal fade" id="myModal" class="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" id="modal-dialog">
<div class="modal-content" id="modal-content">
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('a#paynow322').click(function(){
var form = $("#cusPayment");
var $modal = $('#myModal');
$.ajax({
type: form.attr('method'), //post method
url: form.attr('action'), //ajaxformexample url
data: form.serialize(), // serialize input data values
success: function (data) {
var result=data; //response content html
$('#myModal').modal({
show:true
});
.Is it possible to append response content to modal conten ? 。是否可以将响应内容附加到模态内容?
Yes it is possible. 对的,这是可能的。
try this code on your success cal back. 请尝试此代码,以确保成功。
success: function (data) {
var result=data; //response content html
$('#myModal').find('.modal-content').html(result);
$('#myModal').modal('show');
});
This will update modal contents and show your modal. 这将更新模态内容并显示您的模态。
你的意思是像$('#modal-content')。innerHTML = result吗?
success: function (data) {
var result=data; //response content html
$('#myModal').find('.modal-content').html(result);
$('#myModal').modal('show');
});
i try this and its it worked 我尝试这个,它的工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.