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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:17:31+00:00 2026-05-18T05:17:31+00:00

i have an ASP.net page that generates dynamic xml but the get statement of

  • 0

i have an ASP.net page that generates dynamic xml but the get statement of a jquery ajax request won’t recognize the file. this solution worked with a php doc getting the dynamic xml. The asp.net page that generates xml works fine. The ajax request never succeeds. any ideas as to why much appreciated

<%@ Page Language="C#" AutoEventWireup="true"  Debug="true" ContentType="text/xml" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
    <script runat="server">
        protected void Page_Load(object source, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();
            // XML declaration
            XmlNode declaration = doc.CreateNode(XmlNodeType.XmlDeclaration, null, null);
            doc.AppendChild(declaration);

            // Root element: article
            XmlElement root = doc.CreateElement("statements");
            doc.AppendChild(root);

            string connStr = "";
            string sqlStr = "SELECT [title], [statement] FROM [a table]";
            using (SqlConnection connection = new SqlConnection(connStr))
            {
                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandText = sqlStr;

                    connection.Open();
                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        int indexOftitle = dataReader.GetOrdinal("title");
                        int indexOfstatement = dataReader.GetOrdinal("statement");

                        while (dataReader.Read())
                        {
                            string title = (string)dataReader.GetValue(indexOftitle);
                            string statement = (string)dataReader.GetValue(indexOfstatement);

                            XmlElement xstatement = doc.CreateElement("statement");
                            root.AppendChild(xstatement);

                            XmlAttribute xtitle = doc.CreateAttribute("title");
                            xtitle.Value = title;
                            xstatement.Attributes.Append(xtitle);

                            XmlAttribute xtext = doc.CreateAttribute("text");
                            xtext.Value = statement;
                            xstatement.Attributes.Append(xtext);
                        }
                    }
                    connection.Close();
                }
            }


            doc.Save(Response.OutputStream);
        }
    </script>
<script type="text/javascript">
        $.ajax({
            type: "GET",
            url: "../data/genxml_docstate.aspx",
            dataType: "xml",
            success: parseXml
        });
    });
    function parseXml(xml) {
        alert("ok");
        var items = [];
        var header = 'some initial html'
        $(xml).find("statement").each(function () {
            var title = $(this).attr("title");
            var titleid = (title.substr(0, 8)).replace(" ", "_");
            items.push('<li id="' + titleid + '">' + title + '</li>');
        });

        $('#doclist').append(items.join(''));
        $("#doc_box_right").html(header);

        $(xml).find("statement").each(function () {
            var title = $(this).attr("title");
            var titleid = (title.substr(0, 8)).replace(" ", "_");
            var id = '#' + titleid;
            var statement = $(this).attr("text");
            $(id).css("cursor", "pointer");
            $(id).mouseover(function () {
                $(id).css("background-color", "gray");
                $("#doc_box_right").html('<h2>' + title + '</h2><p>' + statement + '</p>');
            });
            $(id).mouseleave(function () {
                $(id).css("background-color", "transparent");
                $("#doc_box_right").html(header);
            });
        });

    }
</script>
  • 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-18T05:17:32+00:00Added an answer on May 18, 2026 at 5:17 am

    @Chris , can you try firebug .net panel and see if you are getting results for the ajax…so that we can eliminate the issue.It shows the errors also if there are any.

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

Sidebar

Related Questions

I have an ASP.NET page that uses the ASP.NET Ajax Control Toolkit TabContainer .
I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted
In summary : I have an ASP.NET web page that causes an AJAX postback
I have a asp.net page that generates a report. For better or for worse,
I have an asp.net page that calls a dll that will start a long
We have an ASP.Net page that uses a checkbox to toggle between a list
I have an ASP.Net page that contains a <div> with an <img> tag within.
I have an ASP.NET page that calls to a WCF service. This WCF service
I have an ASP.NET page that contains two div's. Both have search fields and
I have a ASP.NET web page that contains many textboxes. Each textbox has a

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.