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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:37:14+00:00 2026-06-01T18:37:14+00:00

I already tried several methods getting my xml-script parsed in java, but i can’t

  • 0

I already tried several methods getting my xml-script parsed in java, but i can’t figure it out!

I have 2 files.
mysql_get.php is returning an XML script if it is called.
post_alert.html is fetching the XML script from mysql_get.php over jQuery $.post(..) as shown below:

function init2() {

    var response;
    $.post("mysql_get.php", function (data) {
        response = data;
        alert(response)
    });
    var xml;
    xml = $.parseXML(response);
    alert($(response).find("item").each(function () {
        $(this).attr("id")
    }));
}

After hit a button which call init2(), i get the response message in xml style as i can see by the alert popup.

<?xml version="1.0" encoding="uft-8"?>
<root>
<collection collection="locationPoint">
    <item id="1">
        <latitude>23.4442</latitude>
        <longitude>51.2341</longitude>
    </item>

    <item id="2">
        <latitude>2849.24</latitude>
        <longitude>213.132</longitude>
    </item>
</collection>

But the alert doesn’t popup “1” in addition as I wished for correct parsing.

What am I doing wrong?

  • 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-01T18:37:16+00:00Added an answer on June 1, 2026 at 6:37 pm

    Here are a couple of things:
    Line 1 of you xml file should read UTF-8 not UFT-8
    Line 2 should be deleted, else make sure you have a closing tag, invalid xml

    Then here is a little example that I hope helps:

    <html>
        <head>
            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
        </head>
        <body>
            <div id="dc"></div>
        </body>
        <script type="text/javascript">
            $(document).ready(function() {
                $.ajax({
                    url: 'mysql_get.php',
                    type: 'post',
                    dataType: 'xml',
                    success: function(data) {
                        $(data).find('item').each(function () {
                            $('#dc').append($(this).attr('id') + '<br/>')
                        });
                    },
                    error: function(data) {
                        $('#dc').html('error');
                    }
                });
            });
        </script>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried several things already, std::stringstream m; m.empty(); m.clear(); both of which don't work.
I already tried all things I could find (on stackoverflow and the net) but
I already tried getting the current URL of my UIWebView with: webview.request.URL . Unfortunately
I have already tried PreRenderComplete and unload is too late
In .NET I have already tried the configuration below successfully: <system.net> <connectionManagement> <add address=*
I use Jersey with JAXB to convert my response to XML. I have several
There are already several threads where this question is discussed, and I have already
I have a LinearLayout view that already contains several elements. I want to add
Has anyone already tried this, anything particulair that I need to be aware of?
Is there anyone who has already tried to use the Microsoft Bing translator web

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.