How to load a custom html module using ajax-call joomla 2.5

狂风中的少年 提交于 2019-12-01 11:15:24

问题


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.

For example http://www.mywebsite/com_custom/id=ID.html ???

Below I have the ajax call:

    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);
        }
); 

回答1:


Ok i found the solution.

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

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

Note that every article has its own ID and ALIAS.

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

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

The ajax call code is:

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);
        }
); 

kisses from Kalymnos,Greece



来源:https://stackoverflow.com/questions/18695025/how-to-load-a-custom-html-module-using-ajax-call-joomla-2-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!