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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:45:49+00:00 2026-05-13T18:45:49+00:00

this is probably so trivial that I’m ashamed to be asking this… Why in

  • 0

this is probably so trivial that I’m ashamed to be asking this…

Why in the world is this not working?

<?xml version="1.0" encoding="UTF-8"?>
<filter id="4" max_values="10">
    <value id="9">strategy</value>
    <value id="11">simulation</value>
    <value id="12">shooter</value>
</filter>

This is the xml response I get when I request the page with:

$.post('afilters/getvaluesXml', {filter_id: fid}, 
            function(response){
                var fields;
                alert(response);

                var filter_id = $(response).find('filter').attr('id');
                var max_values = parseInt($(response).find('filter').attr('max_values'));

                alert('filter_id: '+filter_id+' max_values:'+max_values);

                $(response).find('value').each(function(){
                    var id = $(this).attr('id');
                    var value = $(this).text();

                    if(max_values == 1){
                        fields = fields+'<input type="radio" name="'+filter_id+'" value="'+id+'"/>'+value+'<br/>';
                    } else {
                        fields = fields+'<input type="checkbox" name="'+filter_id+'[]" value="'+id+'"/>'+value+'<br/>';
                    }

                });
                //alert(fields);
                $('#'+filter_id+'_values').text(fields);
            });

Everything works fine except I am unable to get the filter_id and max_values attributes.
This is the alert box content:

filter_id: null max_values:NaN

And, why when I specify the datatype “xml” as described in the jquery .post() docu, nothing gets back to me (no response is ever received – callback is never executed).

  • 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-13T18:45:50+00:00Added an answer on May 13, 2026 at 6:45 pm

    Damn… Well you are all right. It is just me who forgot to set the proper header before outputting the xml…

    So setting the output header to “content-type: text/xml” entirely fixed this problem.

    Seems jQuery won’t execute the callback when the content type is not as expected.

    It is however weird that everything apart those two root node attributes worked 🙂

    Thank you for pointing me in the right direction.

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

Sidebar

Related Questions

I know that this sounds trivial, but I did not realize that the sort()
This is probably trivial, and I do have a solution but I'm not happy
Hey, I am guessing that this is probably fairly trivial, but I am having
This is probably quite trivial but.... I have a quite complicated linq query that
This is probably a trivial question for most but here goes... I am using
This is probably close to trivial, but I can't find it. How can I
This is trivial, probably silly, but I need to understand what state cout is
I know this probably really simple but Im not sure what im doing wrong...
This is probably trivial - I almost feel embarrassed to ask, but I am
This is probably very trivial but I can't for the life of me find

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.