Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3286774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:25:06+00:00 2026-05-17T20:25:06+00:00

My issue involves jQuery .post and Joomla. I have a template with a form

  • 0

My issue involves jQuery .post and Joomla. I have a template with a form that is within one of the accordion areas (using jQuery UI accordion). I have a button type=submit in the form. The form html is generated via jQuery when a user clicks a button in the accordion area.

When a user clicks the form submit button, the event calls jQuery.post, which then is supposed to call a save function within the controller, which in turn calls a save to db function in the model.

The URL for .post is index.php, and I serialize() the form inputs – with the hidden elements, I have the task set to a save function that is within the controller, and the controller defined as well.

The problem is that the save task in the controller is not being called when the button is clicked, nor is the save to db function in the model. After the user clicks on the button, the page redirects to index.php (home page). No save to database.

Any help would be much appreciated.

template.php form elements:

<input type="hidden" name="controller" value="controller" />       
<input type="hidden" name="task" value="saveProgramUI" />'

.js Code:

jQuery('#new_program_form').submit( function () {
    if (jQuery('#new_program_form').valid()) {
        jQuery.post("index.php", jQuery("#new_program_form").serialize(), function(html){
            alert("Data Loaded: " + html);
         });
    }
});

Controller code:

function saveProgramUI(){



    $program = JRequest::get( 'POST' );
    $model = & $this->getModel('pfm');

    $model->saveProgramUI($program);


    $resp = "Hello World!";

    return $resp;

}

Model code:

function saveProgramUI($program)
{

 $programTableRow =& $this->getTable('programs');
// Bind the form fields to the programs table, save to db

if (!$programTableRow->save($program)) {

JError::raiseError(500, 'Error saving program');
} 

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:25:06+00:00Added an answer on May 17, 2026 at 8:25 pm

    SOLVED.

    This was a Joomla issue, not jQuery.

    Needed to add this line to the component file for the component:

    $controller->execute(JRequest::getCmd('task'));
    

    Also added the view view.raw.php and corresponding layout template as well.

    This page was instructive:
    http://docs.joomla.org/How_Joomla_pieces_work_together

    I am new to Joomla development, so went back to the basics to understand things, that page had the answer.

    Thanks to everyone for the ideas!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.