douchun1948 2013-09-10 16:21
浏览 22

PHP - 通过URL加载变量

I'm having trouble getting my head around a concept on a site I'm trying to develop (I'm relatively new to PHP so it's taking me a while).

Basically, I have some html content within a PHP Variable that I'd like to output in a lightbox when clicking a link.

Currently, this works as follows -

echo '<a class="fancybox" id="inline" href="#data' . $limit . '">Read more</a>' ;  

echo '<div style="display:none"><div id="data' . $limit . '"><h2 class="innertitle">' . $item['linktitle'] . '</h2>' . $item['descriptionfull'] . '</div></div>';

So what's happening here is that the variable is loading into a div on the page, which is hidden from the end user, clicking the link then loads this data into a lightbox using Fancybox. This works great but as the number of articles on the site increases (and their descriptionfull html) the page itself is getting very large and taking a long time to load.

So what I'd want to achieve if possible is to get the 'read more' link to point to another php file on the site that when loaded will bring in php variable dynamically. This saves the descriptionfull variables from getting loaded on the main page and should therefore only be loaded when the relevant readmore link is clicked.

Is this possible? Cheers.

  • 写回答

4条回答 默认 最新

  • douzhi8488 2013-09-10 16:26
    关注

    Since you are using fancybox you are already using jQuery, then you could use jQuery ajax to achieve what you want.

    Check this jQuery Ajax POST for reference.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测