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

The Archive Base Latest Questions

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

In a PHP page I have a drop-down list that triggers the jQuery change

  • 0

In a PHP page I have a drop-down list that triggers the jQuery change function and does a POST with AJAX in order to populate a second drop-down list in the page.

It should all be pretty simple, however Firebug throws an syntax error for a ‘?’ that appears in my code at run-time which isn’t actually in my code.

This is my javascript code:

$(document).ready(function() {
    $('#taglist').change(function(){
        $.ajax({
            type: "POST",
            url: "../includes/ajax.php",
            data: "taglist=" + $(this).find("option:selected").attr('value'),
            dataType: 'json',
            success: function(response, textStatus, jqXHR) {
                $("#catlist").html(response.catlist);
            },
            error: function (xhr, textStatus, errorThrown) {
                $("#catlist").html(xhr.responseText);
            }
        });​
    });
});

Following, is the PHP code that executes in ajax.php:

if(isset($_POST['taglist'])){
    $catlist = '<select name="cat_id[]" size="5" multiple id="cat_id[]">';
    $catlist .= fillselecteditmultiple(0, 0, $_POST['taglist']);
    $catlist .= '</select>';

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

fillselecteditmultiple() outputs the options for the populated highlighting those that should be pre-selected. It works fine as I use in other pages without a problem. To make sure it wasn’t an error being thrown from the function itself, I even tried changing the function to output a simple $catlist=’abc’ string as a response, still the same error.

The strange part is that Firebug throws an error at the last 2 lines of the javascript code like you can see in the image attached:

Firebug error
Source code on execution

What could be causing cause the ‘?’ to appear in my code?

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

    Just check your encoding. When you see “strange” symbols in the end of a line, that can be caused mostly with encoding troubles.

    And in addition, common advice:

    When a program doesn’t know how to represent a unicode code point, it
    prints a question mark inside a square (I suppose you have seen this
    before), or in case it cannot, a simple question mark. An unexpected
    question mark always makes a developer suspect of encoding.
    (c)
    Áxel

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

Sidebar

Related Questions

I have a form on a PHP page that has a drop-down list and
I have a drop down list that gets its data from a php web
I have a php page with a dropdown list that is populated by a
I have a dynamic drop down box which calls another PHP page. I've got
I have a web app where I need to change a drop down list
I have select option in my page or drop down list,my problem is how
I have a drop-down navigation that brings the user to the page selected in
I have a drop down list (yii framework) , that i would like to
I have a parent page which has a drop down list in it. using
I have the following code that gets the value of a drop down list

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.