使用jquery打开组件页面 - Joomla

时间:2014-02-03 10:30:44

标签: javascript php jquery joomla

我想在同一页面中使用jquery打开组件'index.php?option ..'的页面:

jquery的:

jQuery("#btnclickme").click(function(){
    jQuery("#divpro").load("index.php?ption=com_hello&view=hello&layout=hello&Itemid");
    });

PHP:

$link = 'index.php?ption=com_hello&view=hello&layout=hello&Itemid; 

HTML:

<a href="<?php echo $link?>" id="btnclickme" name="btnclickme" />
<div id="divpro"></div>

1 个答案:

答案 0 :(得分:0)

您应该阻止点击事件的默认事件,并使用.on来处理直播事件。

jQuery("#btnclickme").on('click', function(ev) {

    // Don't take the user to the page.
    ev.preventDefault();

    jQuery("#divpro").load("index.php?ption=com_hello&view=hello&layout=hello&Itemid");

    // Just in case.
    return false;

});

您可以使用浏览器的开发人员工具来监控网络请求,看看它是否有效,以及正在提取哪些数据(如果有的话)。

相关问题