2

How can I refresh a part of the page when I select from a dropdown list using the onchange in HTML?

I have a Reports dropdown list. Once I select a Report, a list refreshes only displaying those that belong to the report I have selected. From what I am thinking, i need to call javascript function that will call the PHP function that has the query for the list that I will be refreshing.

Sorry if this question seems noobish I am only new with MVC coding.

  • 1
    You have 2 options. You can either run an Ajax script which loads new content based on the option selected in the dropdown. Or you can load all of it and simply hide/show depending on the option selected. If you have a lot of content to be loaded then I would suggest option 1 else option 2 might be easier for you – Lodder Dec 4 '14 at 11:14
4

A simple way to introduce a Ajax is with Joomla Ajax Interface:.

What is The Joomla Ajax Interface (com_ajax)

A slim, extensible component to act as an entry point for HTTP requests for stand alone modules and plugins, thus allowing for the potential of Ajax functionality in them. Com_ajax is generally used when you are not the developer of the component that the module or plugin is interacting with.

NOTE: If you are a component developer, you do not need to use com_ajax to implement Ajax functionality in it. You can do so directly in your component.

Examples of use cases include, but are not limited to:

  • A module that retrieves data from an external API
  • A module that interacts with a component that you did not develop
  • A plugin that implement API like functionality to allow consumption of data from your site

https://docs.joomla.org/Using_Joomla_Ajax_Interface

| improve this answer | |
  • @Break this page seems to be abandoned. If this answer was sufficient in solving your question, please "accept" the answer by awarding the green tick. If you need more support, please edit your question to clarify where you are stuck, and leave Anibal a comment to explain what you would like support with. All questions should progress to a system-recognized resolution. – mickmackusa Jan 28 '19 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.