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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:57:18+00:00 2026-06-15T11:57:18+00:00

$catlistThis is a jQuery POST using AJAX: $(document).ready(function() { $(‘#taglist’).change(function(){ $.post(‘../includes/ajax.php’, { taglist: $(this).find(option:selected).attr(‘value’)},

  • 0

$catlistThis is a jQuery POST using AJAX:

$(document).ready(function() {
    $('#taglist').change(function(){
        $.post('../includes/ajax.php', { taglist: $(this).find("option:selected").attr('value')}, function(data) {
        $("#catid").html(response.catlist);
    });
    });
});

And this is is what happens in ajax.php:

if(isset($_POST['taglist'])){
    $catlist = '<select name="cat_id[]" size="5" multiple id="cat_id[]" class="darkgrey w200px">';
    $catlist .= '<option value="123">123</option>';
    $catlist .= '<option value="456">456</option>';
    $catlist .= '</select>';
    echo json_encode(array("status"=>"success", "catlist" => $catlist));
}

In my real page I will be populating the cat_id select with values depending on the POST. For testing purposes I’m just returning a static select with 2 options.

For some reason I cant grasp, I can’t seem to get the response to appear inside #catid although the post and response are carried out fine (I’m using the Firebug Net panel for monitoring the Post and Response). Please give me your lights on this.

  • 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-15T11:57:19+00:00Added an answer on June 15, 2026 at 11:57 am

    I have noticed that you have no echo related to variable $catlist

     echo json_encode(array("status"=>"success", "catlist" => "abc"));
    

    should be some thing like

    echo json_encode(array("status"=>"success", "catlist" => $catlist));
    

    And you AJAX response code should be updated

    $("#catid").html(response.catlist);
    

    replaced with

    $("#catid").html(data.catlist);
    

    EDIT: I exactly haven’t got what exactly your problem is after above solution but one i thing I can guess is you might be having issue due to json encode you have made on server side in php for that you have to have following chnages in your code.

    var response = jQuery.parseJSON(data);
    $("#catid").html(response.catlist);
    
    • 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.