如何使用ajax-call joomla 2.5加载自定义html模块 [英] How to load a custom html module using ajax-call joomla 2.5

查看:86
本文介绍了如何使用ajax-call joomla 2.5加载自定义html模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html页面中有一个链接,该链接具有类名="flyer"和href ="MY_HREF".
当用户单击链接中的时,我要加载具有特定ID的自定义html"模块.
您能告诉我MY_HREF的语法如何吗?

I have in my html page a link with class name ="flyer" and href="MY_HREF".
When the user click's in the link I want to load a "custom html" module with specific ID.
Can you please advise me how will be the syntax of the MY_HREF.

例如 http://www.mywebsite/com_custom/id=ID.html ???

下面有ajax调用:

    jQuery.ajaxSetup ({
        dataType: "html",
        cache: false  
    });    
    var portfolioItemURL = "";  
    jQuery(".flyer").click(
        function(){
            portfolioItemURL = jQuery(this).find("a").attr("MY_HREF") + '?tmpl=component&type=raw';
            jQuery("#ajaxCallContainer").load(portfolioItemURL);
        }
); 

推荐答案

好,我找到了解决方法.

Ok i found the solution.

1)我们创建我们的html模块,并设置自定义位置,例如myposition

1)We create our html module and we set a custom position e.x myposition

2)我们创建文章,并加载模块 {loadposition myposition}.

2)We create an article and we load our module {loadposition myposition}.

请注意,每篇文章都有自己的ID和ALIAS.

3)我们的ajax调用的最终网址是: http://myurl.gr/ID-ALIAS.html?tmpl=component&type=raw

3)The final url for our ajax call is: http://myurl.gr/ID-ALIAS.html?tmpl=component&type=raw

请注意,如果您在文章中添加任何内容,您将获得文章的html +模块的html.

Note that if you add any content to the article you will get the html of the article + the html of the module.

ajax调用代码为:

The ajax call code is:

MY_HREF = ID-ALIAS.html

MY_HREF = ID-ALIAS.html

jQuery.ajaxSetup ({

        dataType: "html",
        cache: false  
    });    
    var portfolioItemURL = "";  
    jQuery(".flyer").click(
        function(){
            portfolioItemURL = jQuery(this).find("a").attr("MY_HREF") + '?tmpl=component&type=raw';
            jQuery("#ajaxCallContainer").load(portfolioItemURL);
        }
); 

来自希腊卡林诺斯的吻

这篇关于如何使用ajax-call joomla 2.5加载自定义html模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆