【发布时间】:2014-12-23 22:26:35
【问题描述】:
我正在使用 Fancybox V1.3.4。我将表单提交的值返回到父页面时遇到问题。我没有从当前屏幕(子框架)获取值。
添加页面
<div id ="app_fee_list">
Fee Split/ Payment Details box
<a id ="new_app_fee" href="<?php echo base_url('updateappraiserpayment/0')?>" ><i style="margin-left:15px;" class="fa fa-plus-square"></i></a>
<?php $this->load->view('andersion/appraiser/appraiserfeetemplate'); ?>
</div>
这里的fancybox代码是这样的
<script>
jQuery(document).ready(function(){
jQuery('#new_app_fee').live('click', function(){
jQuery(this).fancybox({
'width' : '60%',
'height' : '90%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'onCleanup': function(){
feeid = jQuery('#appfeeform').contents().find("#app_fee_id").val();
alert(feeid);return false; // Here value returns Undefined.
// If the app_fee_id filed is in Add page it will returns.But this field is not in the ADD page. It is in the SUCCESS page.
},
'onClosed': function() {
location.reload();
}
});
}).trigger('click');
});
</script>
它会触发 updateappraiserpayment 页面。提交此表单后,它将重定向到成功页面。
成功页面
<form name = 'appfee1' id='appfeeform' action="<?php echo base_url('updateappraiserpayment/'.$user_id)?>" method='post'>
<div class="col-sm-12">
<section class="panel">
<div class="success">Appraiser fee information has been added successfully</div>
<input type="hidden" name='appraiser_fee_id' id ="app_fee_id" value="3">
</form>
<?php echo $appraiser_fee_id;exit; // Here i get the Inserted Id Value?>
</section>
</div>
成功消息也会显示在 iframe 中。关闭 iframe 后,我需要将插入值的值获取到父页面。我也试过这样
$(".fancybox-iframe").contents().find("#app_fee_id").val();
但我无法得到结果。请给我任何解决此问题的建议。提前致谢
【问题讨论】:
标签: php jquery html codeigniter fancybox