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

  • SEARCH
  • Home
  • 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 8264985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:38:29+00:00 2026-06-08T04:38:29+00:00

I have two dropdown list which is question and answer. At first the answer

  • 0

I have two dropdown list which is question and answer.
At first the answer dropdown list is empty, after the user choose a question, then it will pass the question_id to controller to run a function to get the answer. After the controller get the result, it will pass to the correspond view. Now how can I pass the result to the index view?

the index view:

$("#id_question").change(function() {
var data = $("#id_question").val();
var dataToSend = {question: data}
var href= '<?php echo $this->baseUrl('admin/comment/checkanswer'); ?>';

    $.ajax({ type: "POST",
        url: href,
        data: dataToSend,
        success: function(response){

                //do what u wana do
        }
        });
  });`

the controller:

public function checkanswerAction()
{
    $this->_helper->layout->disableLayout();

    $question_id = $this->getRequest()->getParam('question');

    $answer_model = new Admin_Model_DbTable_Answer();
$answer = $answer_model->getAnswersByQuestionId($question_id);

$this->view->answer = $answer;
  }

the checkanswer.phtml:

foreach ($this->answer as $key => $value)
     {
         echo '<option value="'.trim($value['id_answer']).'">'. trim($value['answer_text']) .'</option>';
       }
  • 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-06-08T04:38:30+00:00Added an answer on June 8, 2026 at 4:38 am

    The content that should be displayed in checkanswer.phtml will be affected to your javascript var response. So if you want to display this in your page, you have to make something like this :

    success: function(response){
        //do what u wana do
        $('#yourSelectID').html(response);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I have one drop down list in my page, which contains two options. What
I have created a populated dropdown list in HTML. When the two dropdowns have
Ok, here is the question. Imagine I have a ModelForm which have only two
I have two DropDown lists which are already populated from the database. If you
Form contains two dropdown lists created using code below. Both dropdown list elements have
A question that I have never solved. I will illustrate with two code samples
I have two relational tables: the Profiles table which contains 3 kinds of user
Afternoon All, I have a dropdown list which extracts data from my SQL database
I have two dropdownlists, and two txtboxes which have a calendar popup extender, whenever

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.