简体   繁体   中英

Fancybox Content do not refresh

I have a problem with my Fancybox, I'm trying to retrieve some php data, but is not reloading properly, I used firebug to track the activity on my page, and it seems that is in fact retrieving the right data from my DB but Fancybox doesn't parse that info, it just shows the first value. Here's my fancybox

$(document).ready(function() {
$(".various").fancybox({
    fitToView   : false,
    width       : '70%',
    height      : '70%',
    autoSize    : true,
    closeClick  : false,
    scrolling   : 'auto',
    titlePosition     : 'inside',
    openEffect  : 'fade',
    closeEffect : 'fade',
    type : 'inline'
}



});
});

And here's a piece of my php code, I'm having problems retrieving the $value['managementSummary']:

echo '<td><p class="various" href="#inline" title="Reference ID # ' . $referenceId . '">' .$value['managementSummary']. ' ...(+)';  
echo '<div style="display: none;"><div id="inline" style="width:400px;height:200px;overflow:auto;"> '. $value['managementSummary'] .'  </p></td></div>';

I know that i have to refresh my content with some sort of function like:

beforeLoad : function() {
this.content = '. $value['managementSummary'] .';

And of course it doesnt work, any ideas??? Thanks!!!

So I was able to fix this issue, i used this code in my fancybox call:

afterLoad: function(){
                this.content = $(this.element).attr('rel');
            }

And I changed my php code as well:

echo '<td><p>' .truncate($value['managementSummary']). ' <a href="#inline" class="various" rel="'. $value['managementSummary'] .'" title="Reference ID # ' . $referenceId . '">...(+)</a></p></td>';
echo '<div id="inline" style="width:400px;height:200px;display:none;"> '. $value['managementSummary'] .'  </div></td>';

It was weird that my content wasn't displaying in the right way, so I used a different div attribute "Rel" to parse my solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM