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 7803027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:26:23+00:00 2026-06-02T01:26:23+00:00

how can i fill a combo box with element from ajax response ps: the

  • 0

how can i fill a combo box with element from ajax response
ps: the combo box is created with Zend_form

My form

<?php

class Application_Form_SearchProduct extends Zend_Form
{

    public function init()
    {
      $this->setName("SearchProduct");

      $a=new Application_Model_Class_Categories();
      $this->setMethod('post');  


      /* Combo box Category*/
        $this->addElement('Select', 'Category',array(
         'label'      => 'Category:',
         'AutoComplete'=> true, 

          'MultiOptions'   => $a->GetCategories(),
         'required' => true )); 


                 /* Combo box SubCategory*/

        $this->addElement('Select', 'SubCategory',array(
         'label'      => 'Sub Category:',
         'AutoComplete'=> true, 


         'required' => true )); 

      $this->addElement('submit', 'Search', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'Search',
        ));  }   }
?>

the js script

<script type="text/javascript">

    //for send data i'll use jquery library

    $(document).ready( function(){
            $('#Category').change(function()
               {

                   var message=$('#Category option:selected').text();
                  if (message != '') {

                      //run ajax

                     $.ajax({
type: "GET", // envoi des données en POST
url: 'http://localhost/EverTags1/Authentification1/public/Product', 

    //baseurl+"/Product/index", 

data:  {'message' : message},

cache: false,
success:  function (respond) {
                               //put respond in class show-msg


                                     //$("#menuLeft").html(respond);  
                                    $("#SubCategory").add(respond);                 

 }
})
 ; }});});
   </script>

my action

  public function indexAction()
    {

       $form = new Application_Form_SearchProduct(); 

       $this->view->form = $form;
       $b=new Application_Model_Class_SubCategories();
       $message = $_GET['message'];
       $result = $b->GetSubCategories($message );
       echo($result[0]) ;

    }

$result[0] contains the folowing string Women’s Clothing

and i have another problem when i choose the element from the first combo box the page autoduplicates and i can’t find the problem

  • 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-02T01:26:24+00:00Added an answer on June 2, 2026 at 1:26 am

    I find the solution of my problem

    <script type="text/javascript">
    
        //for send data i'll use jquery library
    
        $(document).ready( function(){
                $('#Category').change(function()
                   {
    
                      var message=$('#Category option:selected').text();
                      if (message != '') {
    $.ajax({
    type: "GET", // envoi des données en POST
    dataType : 'json',
    url:  //baseurl+"Product/index",
        'http://localhost/EverTags1/Authentification1/public/Product/index', 
    async: false,  
    data:{"message" : message}, 
    success:  
        function (respond) {
    
       var json=JSON.stringify(respond);
       var  objet = eval('(' + json + ')');
    
          e=objet.length;
    
          var str = "";
    
        for ( var count = 0 ; count < e; count++ ) { 
    
    
            str += "<option value='" + count + "'>" + objet[count].name+ "</option>"
        } 
    
         $("#SubCategory").empty().append(""+str);
     }
    
    }
    ); 
    
    }});});
       </script>
    

    the action:

    public function indexAction()
        {
    
    
             $form = new Application_Form_SearchProduct(); 
             $this->view->form = $form;
    
    
    if($this->_request->isXmlHttpRequest()) {
          $this->_helper->viewRenderer->setNoRender();
          $this->_helper->layout->disableLayout();
               $message = $_GET['message'];
    
             $soap_client = new nusoap_client('http://127.0.0.1/evertags/GetCategorySubCategories/servSubCategories.php?wsdl','true');
             $proxy = $soap_client->getProxy();
             $result= $proxy->ReturnSubCategoriesNames($message);
    
              echo $result;
    
    
    
    }
    

    I hope it will help other people

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

Sidebar

Related Questions

How can I fill a combo-box with a list of all the available fonts
I have a from where you can fill in any combination of your home,
I know in C++ and in PHP you can fill a string or a
I need to backup the original data from a table so I can fill
I have a web form that users can fill out and that content fills
I have about 20 text fields on a form that a user can fill
Is there a better way I can fill out a spread sheet on a
I have an ecommerce gift store where users can fill out a gift-card for
I'm a pretty new C# programmer. I was wondering if someone can fill me
On a CAShapeLayer , I've drawn a closed UIBezierPath . I can fill this

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.