how to use Jquery AJAX in Joomla Components?

后端 未结 8 1701
野趣味
野趣味 2020-12-16 07:15

i m developing site in Joomla, meanwhile i stuck in a problem,please help me in below problem

here is my folder structure for component

htdocs/Joomla         


        
8条回答
  •  执念已碎
    2020-12-16 07:31

    That is right, Joomla will load modules, component, whatewer Your default template and Joomla core requires... Change this behavior by using "&format=raw" (this will force Joomla to include Joomla`s "nothing") or "&template=your_own_template_for_ajax" (this will force Joomla to include Your own "nothing").

    I didn`t knew about "&format=raw" so I use my own empty template for ajax. Empty tamplate makes sense for me - I can customize it the way I want (e.g. to include something by default). "&format=raw" is the good option, but not the only one. The decision depends on what You wanna do/get by default.

    How to make such ajax template in front-end?

    You must create a new directory (e.g. "ajax") inside front-end \templates\ directory. Then put 3 files inside:

    index.php:

    
    

    templateDetails.xml:

    ...XML content.. 
    

    Instructions on how to properly create templateDetails.xml can be found here:
    http://docs.joomla.org/Creating_a_basic_templateDetails.xml_file

    index.php:

    
    

    That is all You need for the front-end solution.

    Test it by calling like this: http://www.example.com/index.php?template=ajax

    This is 100% working solution for the front-end. Back-end is not tested by me. I believe You would have to create a separate template for back-end also. Or reach the front-end template somehow (currently have no ideas on how to)...

提交回复
热议问题